I'm just learning PHP and have run into this problem. My PHP code to print the user input data is not showing on a new page. It is working for one page and not for the other and am completely lost after spending a few hours on trying to figure out why. Would be great if someone can point out the flaw.
*PHP is running on the page, I tried it with a simple echo. However, the variables are not working.
production.php
<form method="POST" action="prod2.php"> Desired ending inventory of finished goods at end of Quarter 1: <input type="text" name="fingoodsqrt1" /> <br> Desired ending inventory of finished goods at end of Quarter 2: <input type="text" name="fingoodsqrt2" /> <br> Desired ending inventory of finished goods at end of Quarter 3: <input type="text" name="fingoodsqrt3" /> <br> Desired ending inventory of finished goods at end of Quarter 4: <input type="text" name="fingoodsqrt4" /> <br> <br> Total needs in quarter 1:<input type="text" name="needsqrt1" /> <br> Total needs in quarter 2:<input type="text" name="needsqrt2" /> <br> Total needs in quarter 3:<input type="text" name="needsqrt3" /> <br> Total needs in quarter 4:<input type="text" name="needsqrt4" /> <br> <br> Less beginning inventory of finished goods at end of Quarter 1: <input type="text" name="lessqrt1" /> <br> Less beginning inventory of finished goods at end of Quarter 2: <input type="text" name="lessqrt2" /> <br> Less beginning inventory of finished goods at end of Quarter 3: <input type="text" name="lessqrt3" /> <br> Less beginning inventory of finished goods at end of Quarter 4: <input type="text" name="lessqrt4" /> <br> </form> <form name="input" action="prod2.php"> <input type="submit" value="Next page" /> </form>
prod2.php
<html>
<body>
You have entered the following data, to confirm please click "Next".
<?php
$x=$_POST['fingoodsqrt1'];
$y=$_POST['fingoodsqrt2'];
$z=$_POST['fingoodsqrt3'];
$a=$_POST['fingoodsqrt4'];
$b=$_POST['needsqrt1'];
$c=$_POST['needsqrt2'];
$d=$_POST['needsqrt3'];
$e=$_POST['needsqrt4'];
$f=$_POST['lessqrt1'];
$g=$_POST['lessqrt2'];
$h=$_POST['lessqrt3'];
$i=$_POST['lessqrt4']; ?>
<?php echo "$x" ?>
<?php echo "hello" ?>
<?php
// Make a MySQL Connection
mysql_connect(localhost, "root", "haha") or die(mysql_error());
mysql_select_db("project") or die(mysql_error());
// Insert a row of information into the table "production"
mysql_query("INSERT INTO production VALUES('', '$x', '$y', '$z', '$a', '$b', '$c', '$d', '$e', '$f', '$g','$h', '$i') ")
or die(mysql_error());
mysql_close();
?>
<br>
<br>
Fin goods Qrt 1: <?php echo $_POST["fingoodsqrt1"]; ?><br />
Fin goods Qrt 2: <?php echo $_POST["fingoodsqrt2"]; ?> <br>
Fin goods Qrt 3: <?php echo $_POST["fingoodsqrt3"]; ?> <br>
Fin goods Qrt 4: <?php echo $_POST["fingoodsqrt4"]; ?> <br>
<br>
Needs Qrt 1: <?php echo $_POST["needsqrt1"] ?> <br>
Needs Qrt 2: <?php echo $_POST["needsqrt2"]; ?> <br>
Needs Qrt 3: <?php echo $_POST["needsqrt3"]; ?> <br>
Needs Qrt 4: <?php echo $_POST["needsqrt4"]; ?> <br>
<br>
Less Qrt 4: <?php echo $_POST["lessrawqrt4"]; ?> <br>
Cost / unit raw: <?php echo $_POST["costraw"]; ?> <br>
<a href="manufacturing.html"> NEXT </a>
</body>
</html>
Thanks!

New Topic/Question
Reply




MultiQuote




|