Populating Form From Database, Then Passing Results To Next Page
I have a multiple select input in a form that's being populated by a row
from my database as such:
<input type="checkbox" name="subm[]" value="$row[ID]">
That part is working fine as I can check the displayed page using View
Source and see that the value is the correct row number from the
database. It is then being submitted on a form by $_POST method to
another page where I want to evaluate the checkboxes and display the
contents of the entire row that corresponds to each value="$row[ID]"
that have been checked. But I can't seem to get it to work. I'm having a
problem passing the selected value. Can someone point me in the right
direction?
$query = ("SELECT * FROM `table`");
$result = mysql_query($query);
print "<p>Data for Selections:";
print "<table border=2><tr><th>You chose:";
foreach ($_POST['subm'] as $value) {
print "<tr><td>";
print "$row[ID];
";
print mysql_field_name($result, 1) . ": " . $row[name]."<br>";
print mysql_field_name($result, 2) . ": " . $row[address]."<br>";
print mysql_field_name($result, 3) . ": " . $row[city]."<br>";
print "</td></tr>";
print "</table>
";
}
if (!isset($_POST['subm'])){
print "<p>No matching entry ";
}
mysql_close();
View Complete Forum Thread with Replies
Related Forum Messages:
Populating A Drop Box With Results From Database
I have a MySQL database with a table (category) with two fields, catId (int) and category (char(50)). What I want to do is to get all category names in this database and place all of them into a dropdown box on a web page so that the user can choose from the list of available categories.
View Replies !
Passing 'var' Via GET And Then Populating Page (mysql)
I have a table with a column of numbers (random): 0000000001 0000000026 0000000059 0000000034 And I would like to link them to go to 1 specific template page. Then once on that page, the number that was clicked gets "posted" to the MySQL Query and the information for the page populated dynamically rather than having to have 4 different pages for each number (that's the way I'm doing it now). Code:
View Replies !
Populating A Form Wth Database Info
I've coded a piece of code which populates a form with data read from the database: $connection=mysql_connec ("localhost", "f2821842", "f2821842"); $result=mysql_select_db("QUERIES"); $query=mysql_query("Select * from Emp_Details where emp_num = '$employnum'"); while($row=mysql_fetch_array($query)) {$empname=$row['emp_name'];} <form name="webregform" action="webadmin2.php" method="post"> <input name="requiredname" type="text" size="30" value="<?php echo "$empname"; ?>"> </form> When I echo the $requiredname, I get spaces and no data, and I know that $empname is not a space-it does read a value in a database. 1. How can I get $requiredname to print a value?
View Replies !
Passing Form Results Problem
I have a form that validates itself when the user submits it. I have another page that formats the form results and sends an email. But I don't know how to pass the form results from one page to the other. Here's the form: PHP Code:
View Replies !
Populating Array With Mysql Results
I'm returning a result set of one field in a table, and want to populate an array with the results. I can't for the life of me figure out a simple way to do this without using mysql_fetch_array() to cycle through the results, append that to a var, then explode that into a var and pass that. PHP Code:
View Replies !
Passing Objects Form One Page To Another
Is it possible to transfer objects derived from a class form one page to another? I made 2 testscripts: person.php ------------------------------------- <?php class person { private $_name; public function setName($name) { $this->_name = $name; } public function getName() { return $this->_name; } } $p = new person(); $p->setName("Jim"); $safep = urlencode(serialize($p)); header("Location:person2.php?data=".$safep); exit; ?> person2.php --------------------------------- <?php class person { private $_name; public function setName($name) { $this->_name = $name; } public function getName() { return $this->_name; } } $x = unserialize(urldecode($_GET['data'])); echo $x->getName(); ?> But this does not work for me....
View Replies !
Passing Form Data Through A Page
I'm in the process of creating a new form that stores customer input into a MySQL database. What i'm attempting to do is allow them to fill out their data, and hit 'next' to go on to a file upload form. Upon completing that form and submitting, all information (including their data from page 1) is posted at the same time (so it's all under the same ID). What would be the easiest way to do this? Right now my submit file (submitquote.php) contains the following data (all on one page). Code:
View Replies !
Database Results Into Browser Page (that Is A Downloadable As A CSV File)
i am currently trying to get my script to save some database results to a CSV (Comma Seperated Values) File. getting the format right is not a problem, but having the users browser to save this as a CSV file is!!!. what im trying to do is to display the information on screen, and when they want to, also being able to press File & Save As button in the browser. and then trying to save the file like a CSV file instead of html or txt. is this possible to work out? or will i have to write the information into a self made file (on the server) and give the user a link to the file?
View Replies !
Search Form And Results Page
I have a table called "lista" into my mysql database.This table has 5 text columns : "TRANSLATEDTITLE" "ORIGINALTITLE" "ACTORS" "DIRECTOR" "YEAR" , and 1 image column called "COVER". I want to create a page with a form to search entries into this table (ex. with Title, Actors, Director, Year), and anotger php page with the search results shown inside, everyone with a link that opens a pop window (ex. 400X320). Code:
View Replies !
Displaying Form Results On Same Page
How can I make a form like the following?: <form method="post" action="commentpage.php"> <textarea rows="5" cols="20" wrap="physical" name="comments"> Enter Comments Here </textarea> <input type="submit" value="submit"> </form> <?php echo "$_POST['comments'] was your comment"; ?> I just want to have a form that does everything on one page, instead of being sent to another page with "action="anotherpage.php"".
View Replies !
Need Code To Find Last Page, And Passing All Form Variables
I need to be able to make some sort of php function to pull up the last page viewed so I can pass form varaibles to it etc, so the javascript function go.history(-1) wont work for this situation. After diving thru the php function dictionary for hours on end I'm at a loss for where to look, or what to look for. Also I was wondering if anyone knew an easy way to pass all form variables on to the next page rather than forwarding each manualy. This isn't all that important, but would make the code more efficiant.
View Replies !
Link To Form Results Page Dynamically
I have a dropdown box that pulls information from a database. What I want to achieve is that when a caller selects an option, the option determines that page that comes up. I tried setting the form action to the name of the option, but this down not bring up anything; actually the resulting page is .php. I also tried moving the form action statement after ther selection, but that does not work either - the Submit button does not work. PHP Code:
View Replies !
Populating A Select Box From A Database
I have a subscription database that allows you to edit a subscribers data. For example, you enter a search term like "Bob" and it returns a list of everyone named Bob. You click the one you want and it goes to a subscriber detail page, where all of his data is populated to a form. You can directly edit this form and click save to overwrite it. The only issue is the select boxes (drop downs) - say I have four options in the drop down box, red, blue, green and black. On my details page for bob I end up with five, I have those four PLUS whatever was saved for his color, so it shows up twice. If Bob is green, my select box looks like: Green Red Blue Green Black How can I make it so that Green only shows up once?
View Replies !
Populating A Dropdown From A Database
I have put together a script that populates a dropdown menu from a database. My database contains a table called casinocredit, and it contains records that have been enterend over 2 different months (may and june). There is a field in the database that contains the date in this format: 2006-05-12 00:00:00 So The drop down is currently showing a month for each of those records. I was hoping that it would only display one. (the plan is when a user selects a month (say May) and hits submit, then I would display all of Mays records on a different page) See the image i have attached for a view of what is happening. Code:
View Replies !
Populating Page Content From Mysql Db.
First off my db table is orginized in this way: ImgKey (auto increments) ImgType (pertaining to the buttons in the gallery) ImgName (name of image) When you click a button from the initial gallery page, my plan is to pass a query string to the next page with the appropriate ImgType. On the next page I need to grab all the records in the table with that ImgType. (you can see the next page by clicking the first button) Code:
View Replies !
Re-populating A Form If Errors
I am learning php. I have created a simple Web page with a form. After receing the POST request, I do some error checking. In case of errors, I would like to re-post the page, but with the current values for each field. I have organized my files like this: 1) Webpage with the form (all in html, form action points to a php file) 2) php file that receives the request.
View Replies !
Populating Form Text Box.
I have a PHP form for entering data on-line into a mySQL table.. Because of the intended search facility, I require one field in the form to be completed with exact and precise item names and spelling. In testing, I had achieved this with look-up tables. Ideally I would like the selected item from one of five drop-down lists to autopopulate the form text field when selected. Alternatively at least the option of copy and paste. Copy and paste - for some reason will not work. Autofill worked fine on a test form with no database connection and in standard HTML and javascript, however, once the PHP is added to the page neither method works. Could anyone please point me in the direction of how to get the autofill to work?
View Replies !
Populating Form Fields
I have a online order form that does not require a user to be logged in to use, but if the user is logged in I am attempting to get certain fields to populate with information stored in the database for the user. If the user is not logged in I need the information to be sent to the database.
View Replies !
Populating Form Item From SQL Enum Set Rev#2
$sql = "SHOW COLUMNS FROM table LIKE 'subject' "; $qry = mysql_query($sql) or die("Query not valid: " . mysql_error()); $res = mysql_fetch_object($qry); // This returns a row with a field 'Type' containing 'enum(...)' $res->Type = str_replace('enum('', '', $res->Type); $res->Type = str_replace('')', '', $res->Type); //now the string is something like this: one','two','three $temp = explode('','',$res->Type); //temp is an array with as much elements as the enum while ($temp) print array_pop($temp); This way is much more easier using the elements since they are elements of an array. Cleaver isn't it?
View Replies !
Populating Form Fields With Variables
The script itself works fine: mail gets sent. If there are any missing fields the form displays again with a list of the missing fields, but I can't get the form fields of the reloaded form to be populated with teh existing values. PHP Code:
View Replies !
Auto Populating Form Fields
I know this isn't a PHP thing. But, I've been unsuccessfully looking for how to populate form fields with data found in other fields. For example, I would like to populate shipping information with the billing information - if they are the same. This would save the time from entering the same address twice. Does anyone know of a javascript site that is decent at these options?
View Replies !
Conditionally Populating Form Menus
I wondered if I could ask another question: I have a form which will allow me to populate a garments table within my database. Among the elements in the form, there is a suppliers drop down menu and a categories multiple select menu. I used the following code to populate these menus. Code:
View Replies !
PHP Not Populating Form Variables Passed Through POST Or GET
I"m running: Windows Xp SP2 Apache2 PHP5 MySQL4 Everything seems fine and dandy, and I can do scripting on server side, but for some reason I cannot get data from a form to be put into a variable. I have a simple form in an html page which submits, and in the php script that handles the input, none of the data in the form is going into the variables. My php.ini file does have all the GPC's in place(ie variable_order, the way they get processed).
View Replies !
Populating An Html Form With Mysql Data.
What I have is a basic html form I have made consisting of header fields and fileds that will be populated from a mysql database. The brackets are the actual db fields and denote where I want the data to populate. Here is a small example of the form. Code:
View Replies !
Populating SELECT Multiple Form Field And Inserting Into Db
I have an update form where I'm trying to populate a SELECT multiple field with a list of 48 categories, from tbl work_cat. And show, as SELECTED, the one or many choices that the user had previously selected from the 48 categories which are stored in tbl cat_relations as $relation_cat. Then allow the user to update their selections and update the database. But I can't get my form to work. First problem, I can't get the SELECT field on the form to show the categories, and then I don't know where to go from there. Below are my form page and my processing page. Code:
View Replies !
Passing A Variable To Paginated Query Results
I have a form that passes a single variable via the GET function to a mysql databse query with the results paginated. The first page of the results work fine, but the link to the second page yields the page 2 results of the entire table. I'm guessing that the variable hasn't passed to page2 query? Here's my code:
View Replies !
Passing A Parameter From An HTML Page To A PHP Page
I want to pass a language value (EN/FR/DE etc.) from an Index HTML page to a PHP page with a language code in the call, so that the PHP page can select texts in that language. I would like to to it from an unordered list item if possible by extending the link ... <li><a href="scripts/pricelist.php???>Pricelist[/url]</li>
View Replies !
How To Display "No Results" Instead Of Empty Table On Results Page
I have a search facility on my homepage for a property lettings website. There are 3 search parametres, location, rent and type (e.g. 1bed). It passes the parametres to the results.php page and displays the results in a table. When there are no results, it still displays a table, but it is empty. How do I display some text that says "No Results" instead of an empty table??
View Replies !
Unwanted Characters When Passing Text From Form To Form...
I have a form with a text area that a user can enter a message into, when the form is submitted the user is directed to another page to confirm the content of the message before confirming and entering the record into the database. Here's the problem... if the user enteres "I didn't go to the show" it shows up in the confirmation text area as follows... "I didn't go to the show" How do I get rid of those backslashes?
View Replies !
Populating Form In Parent Window With Value From Popup Window
I have a text box in the parent window.. now i want to populate this text box with a user_id that i will get from query within a popup window.. How do i get the value from the popup window to be passed to the main window form field in php. I know how it can be done in javascript but when i tried combining javascript and php i dont get the desired result.
View Replies !
Passing Variables From A Page To An ASP Page?
I have a site using a PHP CMS and I need it to use an ASP module from another site but I would like to use a frame so it looks like it is still in the same site. I need to pass a username variable from a form in in the PHP webspace (where the domain is pointing) to a page in an ASP webspace (using a subdomain not related to the main domain). I created a frame page in the php hosting with a 1px top frame and the main frame pointing to the asp page but of course the variable is not being passed.....if I put the ASP connection code on the frameset page it doesn't recognize it because the hosting is a Unix/PHP hosting only. My question to you is: Can a variable be passed from the php to the ASP webspace using some other technique? I just need to have the ASP module showing as if it is in the PHP.
View Replies !
Saving Form Results When Form Split Into Four
Im a trying to develop a form which is split into four parts because of its size. Up to now ive always designed my form with all the HTML fields n stuff and had a seperate formhandler which did the PHP stuff. I would like to be able to click a next/submit button after completing the first part, insert the 1st part of the form into the database then go onto the 2nd part of the form- but I would like to be able to click a previous button and have the 1st part of the form I submitted still there with my responses saved (obviously If I went on a previous page and hit next I would like to UPDATE, not insert the 1st part of the form and so on) Code:
View Replies !
Passing Value From First Database
Queried first database and am passing results like this for example: <?php echo $home['dimen'];?> Now I want to query second database using the userid from first query (this is written incorrectly): $result = mysql_query("SELECT a, b, c FROM lists WHERE userid='<?php echo $home['userid'];?>'"); How do I get userid to equal the value of <?php echo $home['userid'];?> How is this written?
View Replies !
Passing Database
I have been scouring the Internet for a good read on creating webpages whose address depends on data retrieved from a from via GET method OR a MySQL database. but counldn't find anything decent. For example, want to create ten pages about 10 different items. Because I want the header, the footer, the navigation to remain the same from page to page, I'd like each page to NOT be a separate html file, but be referenced by something like http://<mysitename>/items/index.php?item_ID=1. Kind of like separate WordPress posts.
View Replies !
Passing Value To Different Page
i have a page home.php which has a dropdown menu for the user to select an institution and a Go button. once the user selects an option, a new page named institution.php will be opened which will display information about the institution which was selected previously. i do not want to have different pages for each institution, so that's why i have one page to display the information according to the option selected in home.php. the problem is, when the user selects an option and click Go, the institution.php doesn't show any data from the db about the institution selected, not even the images that i have. can anyone tell me what's wrong? Code:
View Replies !
My Database Results
I'm trying to create an if statement that will allow me control how information from my database is shown. If theme02 is empty then I only want theme01 so show up, else both of them. if(empty($row['theme02'])) { $themes = "{$row['theme01']}"; } else { $themes = "{$row['theme01']} {$row['theme01']}"; }
View Replies !
Database Results
I have a php/mysql program that displays database results. How can I do this: I want the background colours of the table to be different colours, say blue. I dont want them to be as the same as the colour of the page. I want different colours for the three columns.
View Replies !
[HELP PLEASE] Passing Variable To New Page
I am having hard time passing the variable to the next page. May be you can help me. Let me explain: I am using mySQL database to store information about images (ID, name, author, description, etc). I am pulling some of the information to create this (look at the example here: http://www.gibsonusa.com/test/page/index.php) Now, I want a new window appear when user clicks on the image. I have achieved it with the following script: echo "<script language="JavaScript">"; echo" function pop1() {"; echo" window.open("info.php?prod_id=$result[0]"); }"; $result[0] is variable that stores id of the image in database echo "</script>"; I am calling this function in the following manner: echo"<img onclick="pop1();""; You can see the result if you click on the image. The new page opens up, BUT the id (product_id in this case) value is not passed to the next page correctly. If you click on the first or second image on the first page it shows that the ID is the same for both of them. However if you look at the source code you can see that the ids are assigned correctly. The same thing happens if you click on any image that says “no image available” (I am using different script to generate those). It seems that the script picks up and stores in the memory the value of an ID of the last image generated with the script (I don’t know if that make sense). Oh, by the way the contents of info.php that I am calling in the script above are as following: <? $myid = $_GET['prod_id']; echo" Product ID: $myid<br>"; ?> What am I doing wrong? Can you help? Thank you.
View Replies !
Passing An Image From One Page To The Next.
I want the user to input information, submit it and be able to check it before having it go to the database.This information will include an image.How do I pass the image from the input page to the next page before having it go to the database?
View Replies !
Passing A Variable To A Page
Is it possible to pass a varialble to a page using just PHP/HTML. The object is to create a agenda page, with information comming from MySql, based on the choise of month in the index page in a different frame, i.e. the month is selected in frame 1. Now i want to sent the choice of the user to a page, to be shown in frame 2, that is created with PHP, and use the variable in the MySql query.I know this can be done using java, but i would like to avoid that.
View Replies !
Passing Result To New Page.
I have a search result with a link which links to the ID# of the record. By clicking on the link I would like the rest of the record displayed. What will my script look like to pull a particular record ID?
View Replies !
Passing Strings To Another Page
when this code sends the category to the next page it only sends part of the information.. ex… if the selection consist of 1 word its fine but if it consists of 2 words it only sends the first word >>>”network card” sends the word “network” and not “network card” and if its “monitor” and since its 1 word its fine.. What am I doing wrong.. I’m kind of new to php and if you could let me know it would be greatly appreciated. I think my confusing is with the format of this line perhaps where the quotes and slashes go, not sure. Other wise this code does work. I can see it in the address field that it separates the selection but need to send the whole thing as 1 word. <php echo "<a href="displaylist.php?cmd=".$row["CATEGORY"]."">". $row["CATEGORY"]." (".$row["ENTRIES"].")</A>"; ?>
View Replies !
|