I have a php string variable that is created by php code within an html form ($answer).
I need to pass this string variable along with all the html form input data to another php script specified with the form "action" (post method).
All the html form input data is coming thru fine but not the variable ($answer).
How do I do this?
Here is the php code for importing html form data at the script called in the form action:
$languages = $_POST['languages'];
$answergiven = $_POST['answergiven'];
$problemanswer = $_POST['$answer'];
'languages' and 'answergiven' are form inputs and come thru fine.
'$answer' does not get passed to the second script.
How do I do this?
Here is the php code within the first html form
<?php
// OPEN DATABASE
$username="servics3_sample";
$password="sample";
$database="servics3_sample";
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
// GENERATE RANDOM PROBLEM NUMBER
$probnum = (rand ( 1 , 9 ));
echo $probnum;
// RETRIEVE ANTI-SPAM PROBLEM
$query="SELECT * FROM liasantispam
WHERE `problem number` LIKE '%$probnum%'
";
$result=mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);
$firstnum=mysql_result($result,0,"first number");
$operator=mysql_result($result,0,"operator");
$secondnum=mysql_result($result,0,"second number");
$answer=mysql_result($result,0,"answer");
echo $firstnum," ",$operator," ",$secondnum," = ";
mysql_close();
?>