jcjst21 Posted July 28, 2011 Share Posted July 28, 2011 I am creating a multi-page form for data on an html form and processing it with PHP. i am using a hidden input tage within the forms with the data i want to carry to the next page. I embedded php into the 'value' of the input tag: <td><input type="hidden" name="userid" value="<?php echo $userid; ?>"/></td> however the data is on the page i am currently on because i tested it elsewhere on the page with the echo statement, but it is not being carried over to the next page. Is there something wrong in the PHP echo statement? Thanks, jcjst21 Link to comment https://forums.phpfreaks.com/topic/243133-help-with-echo-statement-in-hidden-input-tag-for-html-form/ Share on other sites More sharing options...
AyKay47 Posted July 28, 2011 Share Posted July 28, 2011 how are you grabbing the value on the other page? Link to comment https://forums.phpfreaks.com/topic/243133-help-with-echo-statement-in-hidden-input-tag-for-html-form/#findComment-1248784 Share on other sites More sharing options...
jcjst21 Posted July 28, 2011 Author Share Posted July 28, 2011 I am using the $_POST function and placing it into a new variable. Link to comment https://forums.phpfreaks.com/topic/243133-help-with-echo-statement-in-hidden-input-tag-for-html-form/#findComment-1248785 Share on other sites More sharing options...
AyKay47 Posted July 28, 2011 Share Posted July 28, 2011 can you post the code where you are grabbing this value... what is the output for this? Link to comment https://forums.phpfreaks.com/topic/243133-help-with-echo-statement-in-hidden-input-tag-for-html-form/#findComment-1248786 Share on other sites More sharing options...
jcjst21 Posted July 28, 2011 Author Share Posted July 28, 2011 sure. The output will be later in another area of the system. I haven't built that page yet; but I am testing to make sure the data populates in the myPHPadmin area and it's not. Actually in this code; NOTHING is writing to the table. <?php $insuranceName=$_POST['InsuranceName']; $insurancePolicyNo=$_POST['insurancePolicyNo']; $insuranceGroupNo=$_POST['insuranceGroupNo']; $subscriberFName=$_POST['subscriberFName']; $subscriberLName=$_POST['subscriberLName']; $camperID=$_POST['camperID']; session_start(); $userid=$_SESSION['userID']; $firstName=$_SESSION['fname']; $lastName=$_SESSION['lname']; $con=mysql_connect("xxxx", "xxxx", "xxxx") or die ("cannot connect"); mysql_select_db("testcamp") or die ("cannot select database"); $sql="INSERT INTO camperInsurance(camperID, cInsuranceNameID, cInsurancePolicyNo, camperInsurancePolicyGroupNo, subscriberOtherFName, subscriberOtherLName) VALUES('$camperID', '$insuranceName', '$insurancePolicyNo', '$insuranceGroupNo', '$subscriberFName', '$subscriberLName')"; mysql_close($con); ?> Link to comment https://forums.phpfreaks.com/topic/243133-help-with-echo-statement-in-hidden-input-tag-for-html-form/#findComment-1248796 Share on other sites More sharing options...
AyKay47 Posted July 28, 2011 Share Posted July 28, 2011 you havn't queried you sql using mysql_query Link to comment https://forums.phpfreaks.com/topic/243133-help-with-echo-statement-in-hidden-input-tag-for-html-form/#findComment-1248799 Share on other sites More sharing options...
jcjst21 Posted July 29, 2011 Author Share Posted July 29, 2011 That was it! Thank you. I can't believe I overlooked that... Link to comment https://forums.phpfreaks.com/topic/243133-help-with-echo-statement-in-hidden-input-tag-for-html-form/#findComment-1248801 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.