I'm having a little trouble passing variables. I'm using some PHP "print" statements to send HTML "FORM" statements. I do this because I need check on some variables to either do one set of HTML code verse another.
IE below
if ($variableOK = 1)
{do this set of PHP code with PRINT "HTML code"}
else
{do this other set of PHP code with PRINT "HTML code"}
I have put a bunch of small pieces of code to figure out what is going wrong (below).
test1.php
test2.php
test3.php
Which just passes variables from test1.php to test2.php to test3.php and prints them out on the way. When I run test1.php TOLERENCE is not passed correctly to test2.php. it should be
+/-.0010
but I get
.0010
from test2.php to test3.php all the variables are lost.
Does anyone know what I'm doing wrong?
Thanks!
test1.php
<?php
$MILL_DIA = .5;
$TOLERENCE="+/-.0010";
echo "<br>\n";
echo "<br>\n";
print
"
<FORM METHOD=\"POST\" ACTION=\"test2.php\" >
<font face=\"Tahoma\">Enter LOC in inches ... ?</P>
<BLOCKQUOTE>
<P>
<INPUT NAME=\"LOC\" SIZE=5 MAXLENGTH=5 value = .75>
<BR>
</P>
<font face=\"Tahoma\">
</BLOCKQUOTE>
<INPUT TYPE=SUBMIT VALUE=\"Next Page\">
<input TYPE=\"hidden\" NAME=\"MILL_DIA\" VALUE =\"$MILL_DIA\">
<input TYPE=\"hidden\" NAME=\"TOLERENCE\" VALUE =\"$TOLERENCE\">
</FORM>
";
print
"
<form method=\"POST\" action=\"test1.php\">
<input type=\"submit\" value=\"Go Back to Start\" name=\"B1\"></p>
</form>
";
?>
test2.php
<?php
echo "LOC = ",$LOC;
echo "<br>\n";
echo "MILL Diameter = ",$MILL_DIA;
echo "<br>\n";
echo "Tolerence = ",$TOLERENCE;
echo "<br>\n";
$Size_Cat = 8;
$Shank_Dia=.25;
$ShankFac= "1/4";
$Oal=3.5;
echo "<br>\n";
print
"
<FORM METHOD=\"POST\" ACTION=\"test3.php\">
Choose Blank Shank ...</P>
<P>
<SELECT NAME=\"SHANKNAME\">
<OPTION SELECTED>1/16 x 1.5
<OPTION>3/32 x 1-1/2
<OPTION>1/8 x 1
<OPTION>1/8 x 1-1/2
<OPTION>1/8 x 2
<OPTION>1/8 x 3
<OPTION>3/16 x 1-1/2
<OPTION>3/16 x 2
<OPTION>3/16 x 2-1/2
<OPTION>3/16 x 3
<OPTION>3/16 x 4
<OPTION>3/16 x 6
<OPTION>1-1/4 x 6
</SELECT>
<BR>
</P>
<input TYPE=\"hidden\" NAME=\"LOC\" VALUE =\"$LOC\">
<input TYPE=\"hidden\" NAME=\"MILL_DIA\" VALUE =\"$MILL_DIA\">
<input TYPE=\"hidden\" NAME=\"TOLERENCE\" VALUE =\"$TOLERENCE\">
<input TYPE=\"hidden\" NAME=\"Size_Cat\" VALUE =\"$Size_Cat\">
<input TYPE=\"hidden\" NAME=\"Shank_Dia\" VALUE =\"$Shank_Dia\">
<input TYPE=\"hidden\" NAME=\"ShankFac\" VALUE =\"$ShankFac\">
<input TYPE=\"hidden\" NAME=\"Oal\" VALUE =\"$Oal\">
<p>
<INPUT TYPE=SUBMIT VALUE=\"Next Page\"> </p>
</FORM>
<form method=\"POST\" action=\"test1.php\">
<input type=\"submit\" value=\"Go Back to Start\" name=\"B1\"></p>
</form>
";
?>
Test3.php
<?php
echo "SHANKNAME IS ",$SHANKNAME;
echo "<br>\n";
echo "LOC (Length of Cut) is ",$LOC;
echo "<br>\n";
echo "MILL Diameter is ",$MILL_DIA;
echo "<br>\n";
echo "TOLERENCE is ",$TOLERENCE;
echo "<br>\n";
echo "Size_Cat is ",$Size_Cat;
echo "<br>\n";
echo "Shank _Dia is ",$Shank_Dia;
echo "<br>\n";
echo "ShankFac is ",$ShankFac;
echo "<br>\n";
echo "Oal is ",$Oal;
echo "<br>\n";
echo "Hello!";
?>