Lance911 Posted April 24, 2009 Share Posted April 24, 2009 I'm new to php and having a little trouble. I've created a html form and a php file. When executed the php file does not function properly. Here's the html form code: <html> <head> <title>Personal INFO</title> </head> <body> <form action= "echo.php" method="post"> First Name:<input type="text" size="12" maxlength="12" name="Fname">:<br /> Last Name:<input type="text" size="12" maxlength="36" name="Lname">:<br /> ... Gender::<br /> Male:<input type="radio" value="Male" name="gender">:<br /> Female:<input type="radio" value="Female" name="gender">:<br /> Please choose type of residence::<br /> Steak:<input type="checkbox" value="Steak" name="food[]">:<br /> Pizza:<input type="checkbox" value="Pizza" name="food[]">:<br /> Chicken:<input type="checkbox" value="Chicken" name="food[]">:<br /> ... <textarea rows="5" cols="20" name="quote" wrap="physical">Enter your favorite quote!</textarea>:<br /> ... Select a Level of Education:<br /> <select name="education"> <option value="Jr.High">Jr.High</option> <option value="HighSchool">HighSchool</option> <option value="College">College</option></select>:<br /> Select your favorite time of day::<br /> <select name="TofD" size="3"> <option value="Morning">Morning</option> <option value="Day">Day</option> <option value="Night">Night</option></select>:<br /> ... <input type="submit" value="submit" name="submit"><br /> </form><br /> And this is my php code: <?php $Fname = $_POST["Fname"]; $Lname = $_POST["Lname"]; $gender = $_POST["gender"]; $food = $_POST["food"]; $quote = $_POST["quote"]; $education = $_POST["education"]; $TofD = $_POST["TofD"]; ?> ... <? echo "Hello, ".$Fname." ".$Lname.".<br />"; echo "You are ".$gender.", and you like "; foreach ($food as $f) { echo $f."<br />"; ... echo "<i>".$quote."</i><br />"; echo "You're favorite time is ".$TofD.", and you passed ".$education."!<br />"; ?> My final output is: "; echo "You are ".$gender.", and you like "; foreach ($food as $f) echo $f." "; echo "".$quote." "; echo "You're favorite time is ".$TofD.", and you passed ".$education."! "; ?> Can anyone see what's wrong? Thanks Link to comment https://forums.phpfreaks.com/topic/155472-new-to-php-can-you-help/ Share on other sites More sharing options...
Mchl Posted April 24, 2009 Share Posted April 24, 2009 Most likely short tags <? are not enabled on your server (use <?php instead). Also possibly you're missing a " somewhere... Please post your further code between tags Link to comment https://forums.phpfreaks.com/topic/155472-new-to-php-can-you-help/#findComment-818106 Share on other sites More sharing options...
Yesideez Posted April 24, 2009 Share Posted April 24, 2009 Welcome Lance! If you post your code between [code] and [/code] tags you can help us as it preserves formatting and color codes everything for us. <?php echo 'This is an example'; ?> Link to comment https://forums.phpfreaks.com/topic/155472-new-to-php-can-you-help/#findComment-818122 Share on other sites More sharing options...
Lance911 Posted April 24, 2009 Author Share Posted April 24, 2009 Sorry people. Code was actually written in Notepad. No color coded tags. Thanks for looking. Link to comment https://forums.phpfreaks.com/topic/155472-new-to-php-can-you-help/#findComment-818606 Share on other sites More sharing options...
mikesta707 Posted April 24, 2009 Share Posted April 24, 2009 seems like your php tags arent being parsed Link to comment https://forums.phpfreaks.com/topic/155472-new-to-php-can-you-help/#findComment-818608 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.