Form Names And PHP
Does PHP handle form names? Suppose I have two forms on one page, named form1 and form2. I pass them to the same php script via the same method. Can PHP distinguish which form was used? How?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Form Button Names As Variables
perhaps I am just a little tired, but I am having trouble with my form buttons. Firstly I name them like this name="round".$counter."heats" which results in variables $round1heats $round2heats $round3heats etc... now, when I select button named ... "round1heats" ... I want to use the variable $round1heats to remove the button "round1heats", and display heats set for the round. To do that I assumed that I would have to:- IF(isset($round1heats)){ show other stuff instead etc }else{ generate and print html for button "round1heats" } My problem is, since all this is dynamic, since the number of heats is variable, and is dependant on DB entries, how do I generate the $round1heats used in the isset() so that it is recognised as a variable by the isset(). I have tried, to concat the bits as I have done in the naming of the button, but, unsurprisingly, it spits out errors ;) [note, $counter is still available, and is limited to the number of rounds registered in DB.] OR, have I been barking up the wrong tree altogether?
How To Process Dynamic Form Field Names
Let me start by saying I don't have a lot of PHP experience, and am just starting to fumble my way around some of this stuff... I'm sure this has been asked a number of times, but after 2 days of searching the internet, I just haven't found a solution that makes sense, so I am hoping someone here can help me. I have a pretty simple project schedule sort of web page that lists a number of tasks & 4 dates associated with each task. (planned start, planned complete, actual start, actual complete. The page is built dynamically based on what is in a mysql database, and the dates listed are form fields, with the intent that a person with access can change any number of these dates. Each task has an id associated with it, so when i build the form, I name the form field <task_id>-<date type>. so, for example, for task id = 10 I have 4 related form fields: 10-planned_start 10-planned_complete 10-actual_start 10-actual_complete This basic pattern is repeated for all the tasks (up to 100 right now, but it could grow slightly). Once all the form fields have been updated, and the user clicks submit I want to update the data in the database with the appropriate data. So, my questions is: 1) How can I process this form, when I don't know what the names of the fields are going to be, and/or how many fields there are? 2) Is there a good way to identify only those fields that have changed and do updates on only those fields, or am I "stuck" updating all the records, even those where the dates have not changed from when the form was built?
Extract Form Field Names When They're Not Known In Advance
I have a page with a form which has automatically generated fields, (which come from mysql column names). There could be any number of these fields, and I have no way of knowing exactly what they're called. But obviously I need to know their names, in order to extract their values on the submission page. They are either of the form c%status#, e%status# or t%status# % is a number between 1 and 13 (inclusive) # could be anything in the pattern 01, 02, 03, with no limit Eg: fields could be c2status03 and e4status07, but I don't know this in advance. These would be generated on the fly from mysql. But on the submission page I need to be able to generate the code $var1=$_POST['c2status'] and $var2=$_POST['e4status07'] Is there a way for me to somehow get these names so I can extract their values on the submission page? Or have I hit a dead end?
Javascript Is Not Accepting Array Form Names
I was doing a PHP project and want the elements in array to be named as id[2], id[4] etc. When I tried to validate those form fields using javascript as: document.formname.id[6].value an error occurs.....
Setting Variable Names Using Field Names?
I'm having trouble creating dynamic variables using field names. Basically I got a heap of fields named after Players and I want to grab the field name and make a variable called it while assigning it a value from a post variable which is also the player name. This is the code I'm using: $result=mysql_query("SELECT * FROM playerstats"); while($fld = mysql_fetch_field($result)) { if ($fld->name!='match_id' && $fld->name!='opponent' && $fld->name!='map') { $fld->name=$_POST[$fld->name]; } }
Bad Names
I have a program that extracts text from a file. But when it extracts the letter “ and some other letters, it outputs them like this: "IllidanĀ“s Revenge". But it first put it into the db
How To Get The Names Of All Sub Objects?
My example: $person->telnumber->value $person->faxnumber->value $person->??? The names of the objects "telnumber" and "faxnumber" (and further possible subobjects) are not known for me. How can I get the names of all subobjects of an object?
Irish Names
I have a problem sending email from a for supplied as html if in the person has to supply an additional Name field it works if his name is Smith but if it is O'Brian it fails. is there away to overcome this apostrophe problem.
Pdo Get Field Names
I'm using PDO for the first time. I want to get the field/column names from a SELECT query. I can get the names from the associative array returned by fetch(). But how do I get the field names if the SELECT query returns no rows? I could do this before with the xxxx_fetch_field() functions. Here's a condensed version of my code: // query the database $DbToQuery = new PDO("sqlite::memory:"); $DbToQuery->query("CREATE TABLE MyTable (MyField TEXT)"); $sql = "SELECT * FROM MyTable"; $result = $DbToQuery->query($sql); // Get the number of columns $Cols = $result->columnCount(); // Loop through the results $countrows = 1; while($row = $result->fetch(PDO::FETCH_ASSOC)) { if($countrows == 1) { // Print column names print join(",", array_keys($row)); } $countrows++; // handle the row data // ... }
Variable Names
I want to create a series of variable names in the form of $dist_1, $dist_2, $dist_3 etc....How can I do this using a loop? A scaled back example (ie, forgetting about the for loop syntax) of what doesn't work is: $i = 1; $dist_'$i' = 50; echo $dist_1; I have tried all sorts of variations like $dist.$i, $dist"$i", but none of them seem to work. I could create an array dist[$i] but that is going to cause problems elsewhere.
Subdomain Names?
i have a website which is functional since 2006. But now i just want to add some new services like SMS and so on. i want users to type sms.mywebsitename.com to access the page with the sms service. but i am not aware of how to make the subdomain i mean sms prefix.
Page Names?
Is it possible to somehow read a page title based on the page you are one. for example: if the page is: mainpage.php so inside the mainpagephp it would say: include "pagetitles.inc"; and inside the the pagetitles.inc file it would say something like: if whateverpage echo $pagetitle = "Main Page";
Domain Names
I am writing a reporting tool for the open source project Dansguardian, right now I am taking a URL that a user has visited and need to compare it to a blacklist, which contains just domain names (i.e. - phpfreaks.com). I currently have some code which does this but it does not work for https URL's. Here is the code:
Add Commas Between Names
i've got a script that pulls first name, last name, and suffix from a DB query and echos them only if they are not null. the names are cross-referenced by id number from two other tables. it displays the name pieces that are not null for each "job", and the jobs and names are determined by another id number for an individual issue page. an example of the output is here: Code:
Column Names
how can i get the column names of ms access table?
Php Sessions Over 2 Domain Names
When developing I created two under the same domain name. Both site share most of the same content and database. One of the sites is basicly just a frontend that accesses the pages from the other site and depending on what site you're comming from, the color is different, menu is different, etc... this worked fine with the domains were setup like this: But once the sites were put under URL and URL everything failed. All the session information is lost when accessing a page from the other site. Does anyone have any experience with this?
Sessions And Domain Names
I've got an app that dumps a user id into a session after successful login. the login page is http://www.mydomain.com/login.php. If the user visits pages on my site without the www (i.e., http://mydomain.com/foo.php), the session works fine and login state is maintained. If he visits http://www.mydomain.com/foo.php, the app drops the logged-in state. Any idea how to fix this? I'm running php 4.4.1 w/ linux apache.
Getting File Names On Another Server With PHP
My ISP provides me with minimal space on a dedicated server running PHP, and 250MB on a separate HTTP server. I'm trying to make a gallery using PHP. The script is held on the PHP server, and the thumbnails and images are on the separate HTTP server. Ideally I'd like to be able to get a listing of the contents of the HTTP server where the images are stored. I want to do this so that when I add/delete/change images, the dynamic nature of the site just picks up the new files and I don't have to maintain a separate database of the image names and where they're stored.
How To Make DIR-Names Substituted
I want to make my directories hidden, and I have seen some sites using a very long string to "hide" the real DIRectory name. any idea on how to do this in PHP? The purpose is to make the sites linked to unreachable for users, they see a link in the buttom of the page, or the see it in the address line og the browser, but I want it to be a "Virtual" link, that only exists in the one session they are in. As soon they leave the page, the link must be "erased/unuseable"
File Names Into Array
right so im in the midst of creating a gallery for a friend of mine, i have most of it right, but when i get the file names from the directory and into an array i have the ".." and "..." as the first two elements, any ideas? my getImages functions is simply as follows: #PHP function getImages() { global $images; $mydir = opendir(images); for($i=0; $i<10; $i++) { $entryname = readdir($mydir); $images[] = $entryname; echo("<br>"); } #PHP
Dynamic Variable Names
I have a shopping cart page that allows a user to type in a new quantity and press a [Submit] button. The quantities entered are in form text boxes with the names "item302", "item7812", etc. reflecting which item that particular textbox is associated to. I store the entered variables using 'import_request_variables("p","p_")' so I end up with $item302, $item7812, etc. My script looks for these variables by looking through the shopping cart array which stores the item numbers themselves and then checks the value of $item<whatever>. If I have a number stored in $item is there any easy way to tell PHP to check the value of variable $p_item<item>? For example, if $item is ¹Ż' how can I tell PHP to evaluate $p_item302?
Get Names Of Cookies And Run Them Against Database
I set several cookies on the page. Now I need to get the name of each cookie I set and run it against my database if the name from the cookie matches the "ID" in my database I want to display this record. PHP Code:
File Names In Directories
On my current website I have gallery pages with links to different galleries within that gallery section. The problem is, that I have to manually edit every single page when I want to add a new page so that every page now has a link that includes the new page number. Now I have been thinking that surely PHP could be used to automate this instead of me doing it every time I put a new gallery page online. What I'd like to know is if it is possible for PHP to read a file name, then use that to "echo" it into the HTML, then go to the next file name - do the same, until there are no more like sounding filenames in that directory. So for example, I have gallery01, gallery02, gallery03 webpages. I ask PHP to look for a match for "gallery", then add the file number "01", and echo it to the HTML page, and then do the same until there are no more "gallery" pages to be found in that directory. If possible, scould someone point me in which direction to do this (I don't need / want a complete solved solution :) ).
How Can I Get Session Variable Names
Is there any way through which I can get what session variables are created in the session. Suppose there are two pages. Page A and page B Page A has a link for page B When a person clicks link of Page B on Page A, he should get the list of all session variables and there values. Is this possible? Also is it necessary that Page A should also be in php. Will it work if it is java.
Sessions And Domain Names
I've got an app that dumps a user id into a session after successful login. the login page is http://www.mydomain.com/login.php. If the user visits pages on my site without the www (i.e., http://mydomain.com/foo.php), the session works fine and login state is maintained. If he visits http://www.mydomain.com/foo.php, the app drops the logged-in state.
Using Variables At Table Names
Do you guys know how to use PHP variables as table names? I'm trying to create a function that can be used by several pages. PHP Code:
Assembling Variable Names
Is it possible to use a variable by assembling two or more other variable: $varname = 3; $foo = "var"; $bar = "name"; $something = $foo$bar I know that probably won't work, but I want to do something like that.
Finding Variable Names
I am writing a generic function to send an http POST request directly from a PHP script. The idea is that you can send as many variables as you like to the function and it will produce a URL encoded string, as follows... $request .= '&$var1Name=' . urlencode($var1); $request .= '&$var2Name=' . urlencode($var2); ...etc. It then sends this (along with the header info) with an fsockopen() function. My problem is that I have no way of finding out the name of the variables that are being send to the function.
Reading File Names
Im writing a php file that will upload pictures in a remote directory. Im actualy doing a buletin board,and i have a mysql table that has subjext message date and entries(key) columns. I want the user to be able to aslo upload a image when posting a message. So I figured the best way to do this is to upload all files in a dirr and add the column 'image filename' to the mysql table for each entry. Im not sure how to read the file names for each entry. My guess was to use $image = basename($path); but how will it know to store differet file names for each entry in the table. Does anyone know ?
Need Column Names, Not The Array Key...
I am running a script that exports a MySQL table into an excel file. The problem I am having is the column (header) names are not showing up in the final .xls file. I instead get the key value 0, 1, 2, etc. Here is the section of the code that should write the actual names. I can't figure out what's wrong. It looks good to me. Am I missing something? Code:
Upload Images With Names
Is there a way that I can upload an image to a directory on my website and have the image name recorded into a database field without having to create a separate field for that name?
Dynamic Variable Names.
I want to make it so the name of a variable is changed by '$z' I'm not sure how to do this. Right not I'm trying: [$row + $z] = 1 But it doesn't work.
Reading File Names In A Directory.
I'm quite new to PHP, just getting my feet wet really, and I was wondering if I can scan a directory? ie. Counting all files in a certain folder with a ".txt" extension or maybe all files in a folder that contain "news" in it's name.
Displaying MySQL Column Names Using PHP
I'd like to be able to display the column names of a table on a page. Is there a way to read that information in using SHOW? And then to display that information again? Or would I have to store these names in a seperate table and display these values? I tried this, but it sure didn't work: $result = mysql_query ("show columns from industries"); print ("<table>"); if ($row = mysql_fetch_array($result)) { do { print ("<tr><td bgcolor=#cccccc>"); print $row["field"]; print ("</td><td bgcolor=#cccc00>"); print $row["type"]; print ("</td><td bgcolor=#cccc00>"); print $row["null"]; print ("</tr>"); } while($row = mysql_fetch_array($result)); } else {print "Sorry, no records were found!";} print ("</table>");
Listing Field Names - Confusion
I'm trying to simply list the names of fields within a certain table. On another page I figured out how to list the available tables within a database, using the list_tables & table_name, so I figured I could do the same using the list_fields & field_name - but it doesn't seem to be working. Code so far: (works with table list/name) <? $connect = mysql_connect("localhost","login","pass"); $result = mysql_list_fields($db,"tablename"); $i = 0; while ($i < mysql_fetch_array($result)) { $tb_names[$i] = mysql_field_name($result, $i); echo "$tb_names[$i]<br>"; $i++; } ?>
Duplicate Variable Names In The URL Need To Be Put Into An Array
I have a url with duplicate variable names and I need them to be dumped into an array. For example if I have http://www.google.com?boo=0&boo=1&boo=2 I want to have an array that is boo[0] = 0, boo[1] = 1, boo[2] = 2 How do I do this? I know $_SERVER['argv'] will grab everything after the '?' in the URL, but I don't know what do from there.
Building Variable Names Automatically.
I have written a script that will go through a directory and find certain files that are sorted in categories. The name field in the form will be generated with a while loop where the name will look like: name11 name12 name13 name21 name22. and so on. Now I want to retrieve these values and store them into the database in the script where they are passed to. How do I put this into a while loop when I only know the $name part. The maximum value of the other two are passed along, but I do not know how to put it together as one variable. If I try $name$num1$num2 it won't work aswell as putting into quotations. I can see why it doesn't work, but I can't come up with a solution for it. basically I want to build $name11 , $name12 , $name21 out of what I have and then I can retrieve it. Let me know if you don't understand what I tried to explain and I will clarify it for you. The directory can contain up to 500 files.
Dynamic Variable Names For Objects
I need to use dynamic variable names but for objects. As you know something like that works fine: $variable="content"; $part="able"; echo ${"vari".$part}; // gives out content but i need to use a database object after a mysql query something like that $sqlresult= mysql_query("SELECT * FROM t_table_xy"); while (($obj = @mysql_fetch_object($sqlresult)) { echo ${"obj->f_".$fieldname[1]}; } but this dont work, I suppose because of the -pointer. has someone an idea how to solve that ?
How To Cache Pages With Login Names
I'm fairly new to this web authoring lark, and I was pondering today how to optimise my site for cacheing, but as far as I can see there is no way to do it. My site has a standard header that includes the option to either "Login" or "Logout <username>". This header is generated by PHP reading the session ID and looking up the corresponding username. I guess I could cache the username in the user's session data to save a DB lookup (or maybe even a cookie to save looking up any session data at all). However, I still cannot see how I can ever cache the resultant page since the header is user specific, even if everything else is static? How do other people handle this? Having the username at the top seems a pretty common design, so I guess the problem must have been tackled somehow?
Get A List Of File Names From The Server
im working on a flash interface that needs to call a script that reads a directory on the server and returns the names of the files that are there. what would the php command look like that would get the file names?
Numeric Column Names In Mysql?
i am trying to create a table with a column name called 2004. But I keep getting a mysql error? Is there any workaround? Unable to execute: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near �� TEXT,2004_reference TEXT,2005 TEXT,2005_reference TEXT,200 CREATE TABLE test (id int(6) NOT NULL auto_increment, membership_number TEXT,first_name TEXT,last_name TEXT,spouse TEXT,phone_priv TEXT,phone_bus TEXT,address_street TEXT,addr_town TEXT,addr_city TEXT,membership TEXT,donor TEXT,1998sa TEXT,1999sa TEXT,2000sa TEXT,200s1 TEXT,2002sa TEXT,2003sa TEXT,2003_reference TEXT,2004 TEXT,2004_reference TEXT,2005 TEXT,2005_reference TEXT,2006 TEXT,2006_reference TEXT, PRIMARY KEY (id),UNIQUE id (id))
Compare Two Names Based On Characters
I wasn't sure how to describe what I want in the subject line so hopefully this post will allow me to further explain. I have a table where I have names of people who have filed evictions against their tenants. These plaintiffs have no mailing street addres. They have a city, state, and zip code. In another table, I have a massive listing of those plaintiffs who have filed evictions against their tenants but each record includes a full mailing address; street, city, state, and zip. What I'm trying to figure out is how to write a little PHP program to compare the name fields of table 1 (without address) into table 2 (with addresses) and replace the address in table 1 with the address from table 2 based on the match. I would also like the capability to match combined fields from table 1 into table 2, meaning, if I were to combine name, city, state, and zip in table 1 and combine name, city, state, zip in table 2, I will most likely have the ability to reduce the list.
|