Hello all,
I'm trying to get through this tutorial, but running into a brick wall. I'm not very versed with PHP, so the error may be simple.
I'm trying to call the data that the user inputted to the PHP form, but it's only displaying blank lines for me. I've read multiple tutorials online, but was not sure if all of the 'names' for the checkboxes were supposed to be the same or where to include the '[]' for each name. For each feature, I want it to display 'on' if it's checked and nothing if it's not checked, just to keep what I have in the HTML (i.e. "Rust: ".
Line 12 of the PHP code is where the issue begins as far as not knowing what to code.
Here's my HTML:
<form action="cart.php" method="get">
<html>
<head>
<title>Jason's Demo Form</title>
</head>
<body>
Welcome to Jason's Widget Emporium. Select the following items to customize your
widget.<p>
Engrave your widget with a personal message:<p>
First Line <input type="text" name="firstline" /><BR>
Second Line <input type="text" name="secondline" />
<br>
Choose your color:<br>
<input type="radio" name="color" value="red">Red<br>
<input type="radio" name="color" value="green">Green<br>
<input type="radio" name="color" value="blue">Blue<br>
<br>
Additional Features to Include:<br>
<input type="checkbox" name="f[]" value="better">20% Better (Add $10) <br>
<input type="checkbox" name="f[]" value="rust">Rust Proofing (Add $20) <br>
<input type="checkbox" name="f[]" value="gift">Gift Wrapping <br>
<br>
Enter any special processing instructions here:<br>
<textarea rows=5 cols=50 name="special"></textarea>
<p>
<input type="submit" name="submit" value="Add to Shopping Cart">
</body>
</html>
</form>
And here's the PHP:
<html>
<head>
<title>Shopping cart test</title>
</head>
<body>
Line One is: <?php echo $_GET["firstline"]; ?> <br>
Line Two is: <?php echo $_GET["secondline"]; ?> <br>
Color is: <?PHP
$selected_radio = $_GET['color'];
print $selected_radio;
?><br>
Better is:
<?php
$better=$_GET['better'];
foreach ($f1 as $better)
{
echo "on";
}
?><br>
Rust Proofing is:<br>
Gift Wrapping is: <br>
Special instructions are: <br>
</body>
</html>
Any help is greatly appreciated :)