JayCee Posted June 18, 2009 Share Posted June 18, 2009 Hi, Just wondering if anyone knows if I can select an entry from a drop down in one page, upon the update this moves to page 2 automatically and the selection from page 1 has populated a field in a form on page 2. Does this make sense and does anyone have an idea where to start? Cheers, JC. Link to comment https://forums.phpfreaks.com/topic/162728-populate-a-field-in-a-different-page/ Share on other sites More sharing options...
JayCee Posted June 18, 2009 Author Share Posted June 18, 2009 Hi, I've changed my plans, just so that I can get on with completing the task. As a result, I have a page with a form: <html> <body> <form action="insert4.php" method="post"> Name: <input type="text" name="Name" /> Surname: <input type="text" name="Surname" /> Comment: <input type="text" name="Comment" /> Type of Query:<select name="Type"> <Option>Attendance</Option> <option>HOH</OPtion> </select> <input type="SUBMIT" /> </form> </body> </html> I then have a PHP page which I'm hoping will do 2 things 1. write the results to a mySQL database 2. email the form depending on the option selected This is my PHP page: <?php $Name = $_POST['Name']; $Surname = $_POST['Surname']; $Comment = $_POST['Comment']; $Type = $_POST['Type']; if($type == "Attendance") $emailaddress="*********"; elseif ($type == "HOH") $emailaddress="**********"; else {exit;} mail($email,"First Name",$Name,"Surname",$Surname,"Comment",$Comment); mysql_connect ("localhost","root","test") or die ('Error: ' . mysql_error()); mysql_select_db ("results"); $query="INSERT INTO entries (Name, Surname, Comment, Type)VALUES ('".$Name."','".$Surname."','".$Comment."','".$Type."')"; mysql_query($query) or die (mysql_error()); ECHO "<meta http-equiv=\"refresh\" content=\"3; url=http://localhost/testweb/formdone.html\">"; ?> 90% of this is working correctly. However, the Type field is not being recorded in the Database, is this becasue it is an option box not a text box. Also the email is not being sent. Anyone got any ideas? Cheers, JC. Link to comment https://forums.phpfreaks.com/topic/162728-populate-a-field-in-a-different-page/#findComment-858778 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.