Jump to content

help with echo statement in hidden input tag for HTML form


jcjst21

Recommended Posts

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

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);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.