silverglade Posted March 20, 2009 Share Posted March 20, 2009 hi, i made a php form from this book by larry ullman. and i copied the code exactly i THINK. and when i test on my server the page shows up blank. it is called "register.php", here is the code to it below, any help greatly appreciated. thank you. derek <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Register</title> </head> <body> <!-- Script 6.8 - register.php --> <p>Please complete this form to register: </p> <form action="handle_reg.php" method="post"> <p>First Name: <input type="text" name="first_name" size="20" /> </p> <p>Last Name: <input type="text" name="last_name" size="20" /></p> <p>Email Address: <input type="text" name="email" size="20" /></p> <p>Confirm password: <input type="password" name="confirm" size="20" /> </p> <p> Date Of Birth: <select name="month"> <option value="">Month</option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="day"> <option value="">Day</option> <?php //print out 31 days for ($d=1; $d<=31;$d++){ print "<option value=\"$d\">$d </option>\n; } ?> </select> <input type="text" name="year" value="YYYY" size="4" /></p> <p>Favorite Color: <select name="color"> <option value="">Pick one</option> <option value="red">Red</option> <option value="yellow">Yellow</option> <option value="green">Green</option> <option value="blue">Blue</option> </select> <p> <input type="submit" name="submit" value="Register"/></p> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/150408-solved-php-form-shows-up-blank-in-browser/ Share on other sites More sharing options...
redarrow Posted March 20, 2009 Share Posted March 20, 2009 you missed a double quote line 54 <option>";<<<<< <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Register</title> </head> <body> <!-- Script 6.8 - register.php --> <p>Please complete this form to register: </p> <form action="handle_reg.php" method="post"> <p>First Name: <input type="text" name="first_name" size="20" /> </p> <p>Last Name: <input type="text" name="last_name" size="20" /></p> <p>Email Address: <input type="text" name="email" size="20" /></p> <p>Confirm password: <input type="password" name="confirm" size="20" /> </p> <p> Date Of Birth: <select name="month"> <option value="">Month</option> <option value="1">January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="day"> <option value="">Day</option> <?php //print out 31 days for ($d=1; $d<=31;$d++){ echo "<option value=\"$d\">$d </option>\n"; } ?> </select> <input type="text" name="year" value="YYYY" size="4" /></p> <p>Favorite Color: <select name="color"> <option value="">Pick one</option> <option value="red">Red</option> <option value="yellow">Yellow</option> <option value="green">Green</option> <option value="blue">Blue</option> </select> <p> <input type="submit" name="submit" value="Register"/></p> </form> </body> </html> <?php //print out 31 days for ($d=1; $d<=31;$d++){ print "<option value=\"$d\">$d </option>\n; //<<<<<< double quote \" was missing. } ?> Link to comment https://forums.phpfreaks.com/topic/150408-solved-php-form-shows-up-blank-in-browser/#findComment-789900 Share on other sites More sharing options...
silverglade Posted March 20, 2009 Author Share Posted March 20, 2009 holy cow redarrow! you have quick eagle eyes!!. i never would have caught that if i looked over my code for an hour LOL. thank you very much for solving that and taking the time. thanks.. derek. it works great now. neat. my first php generated code. Link to comment https://forums.phpfreaks.com/topic/150408-solved-php-form-shows-up-blank-in-browser/#findComment-789903 Share on other sites More sharing options...
redarrow Posted March 20, 2009 Share Posted March 20, 2009 go slowly and advance the code take your time mate. i promise it pays of. your letting a user choose a color red,yellow,green,blue. you also need to add a http://www.captcha.net/ also you need to add md5($password); but like the book says it all takes p ascents. Link to comment https://forums.phpfreaks.com/topic/150408-solved-php-form-shows-up-blank-in-browser/#findComment-789905 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.