music_fan01 Posted May 3, 2009 Share Posted May 3, 2009 I am working on this web page maker and teaching myself php at the same time. I was wondering is someone could please help me fix my problem to get my php page up running. When I test it I get a blank page. I think it may be how I set up my for statement and code in my php file. HTML form <!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=iso-8859-1" /> <title>Web Page Generator</title> <script type="text/javascript"> function formReset() { document.getElementById("webPageGeneratorForm").reset() } </script> </head> <body bgcolor="purple"> <center><h1>Web Page Generator</h1></center> <form action="webPageGenerator.php" method="POST" id="webPageGeneratorForm"> <center><b>Enter your page title:</b><br/> <input type="text" name="pageTitle" /><br /><br /></center> <center><b> Choose your background color:<b><br/> <td> <input type = "radio" name = "pageBackground" value = "pink" checked = "checked" /><font color="pink">Pink</font><br /> <input type = "radio" name = "pageBackground" value = "teal" /><font color="teal">Teal</font><br /> <input type = "radio" name = "pageBackground" value = "blue" /><font color="blue">Blue</font><br /> <input type = "radio" name = "pageBackground" value = "lime" /><font color="lime">Lime</font></a> <br/> </td> </tr> </table><br/></center> <center><b> Choose your text color:<b><br/> <td> <input type = "radio" name = "textColor" value = "black" checked = "checked" />Black<br /> <input type = "radio" name = "textColor" value = "maroon" /><font color="maroon">Maroon</font><br /> <input type = "radio" name = "textColor" value = "red" /><font color="red">Red</font><br /> <input type = "radio" name = "textColor" value = "yellow" /><font color="yellow">Yellow</font></a> <br/> </td> <br/> </center> <center> <b>Pick your font:</b></br> <td> <select name = "pageFont"> <option value = "arial">Arial</option> <option value = "helvetica">Helvetica</option> <option value = "times">Times</option> <option value = "serif">Serif</option> <option value = "verdana">Verdana</option> </select> </td> </center><br/><br/> <center><b>Enter up to 7 links:</b><br/> <b>Link 1:</b><input type="text" name="url" /><br /><br/> <b>Label:</b><input type="text" name="label" /><br /><br/> <b>Link 2:</b><input type="text" name="url" /><br /><br/> <b>Label:</b><input type="text" name="label" /><br /><br/> <b>Link 3:</b><input type="text" name="url" /><br /><br/> <b>Label:</b><input type="text" name="label" /><br /><br/> <b>Link 4:</b><input type="text" name="url" /><br /><br/> <b>Label:</b><input type="text" name="label" /><br /><br/> <b>Link 5:</b><input type="text" name="url" /><br /><br/> <b>Label:</b><input type="text" name="label" /><br /><br/> <b>Link 6:</b><input type="text" name="url" /><br /><br/> <b>Label:</b><input type="text" name="label" /><br /><br/> <b>Link 7:</b><input type="text" name="url" /><br /><br/> <b>Label:</b><input type="text" name="label" /><br /><br/> </center> <p><center><b>Below you may fill out three (3) paragraphs with the desired content.</b></p></center> <center><b>Paragraph 1<b><br/><br/><br/><br/><textarea name="pageText" cols="40" rows="5"></textarea></center><br /><br /><br/> <center><b>Paragraph 2<b><br/><br/><br/><br/><textarea name="pageText" cols="40" rows="5"></textarea></center><br /><br /><br/> <center><b>Paragraph 3<b><br/><br/><br/><br/><textarea name="pageText" cols="40" rows="5"></textarea></center><br /><br /><br/> <center><input type="submit" name="submit" value="Make My Page"><input type="button" onclick="formReset()" value="Clear"></center> </form> </body> </html> PHP code <!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"> <?php $pageTitle = $_POST["pageTitle"]; $pageBackground = $_POST["pageBackground"]; $textColor = $_POST["textColor"]; $pageFont = $_POST["pageFont"]; $url = $_POST["url"]; $label = $_POST["label"]; for ($u=0; $u <7; $u++) { if ($url[$u] != "" and $label[$u] != "")} $pageText = $_POST["pageText"]; ?> <head> <title><?php echo $pageTitle; ?> </title> </head> <html> <body style="font-family: $pageFont; color: $textColor; background-color: $pageBackground"> text-align: center; font-size: 14pt">$pageText</p> <b><u><center><?php echo $pageTitle; ?></b></u></center> <br /><br /> <center><p> <?php echo $pageText; ?></p></center> </body> </html> Link to comment https://forums.phpfreaks.com/topic/156608-web-page-maker-i-get-a-blank-page/ Share on other sites More sharing options...
jackpf Posted May 3, 2009 Share Posted May 3, 2009 I think you need to turn on errors - ini_set('display_errors', E_ALL); Link to comment https://forums.phpfreaks.com/topic/156608-web-page-maker-i-get-a-blank-page/#findComment-824607 Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 Your for loop isn't complete. for ($u=0; $u <7; $u++) { if ($url[$u] != "" and $label[$u] != "") } You forgot something after the if statement. Also, it's best if you say - if (!empty($url[$u])) Lastly, and *MOST* importantly, learn HTML! You're closing tables you're not opening and calling <td> and <tr> when a table tag isn't opened. Link to comment https://forums.phpfreaks.com/topic/156608-web-page-maker-i-get-a-blank-page/#findComment-824611 Share on other sites More sharing options...
music_fan01 Posted May 3, 2009 Author Share Posted May 3, 2009 Can you please tell me what I forgot after my if statement? Link to comment https://forums.phpfreaks.com/topic/156608-web-page-maker-i-get-a-blank-page/#findComment-824616 Share on other sites More sharing options...
Ken2k7 Posted May 3, 2009 Share Posted May 3, 2009 Can you please tell me what I forgot after my if statement? Nope. I'm not psychic. I don't know what you want after that if statement. What are you trying to do with the for loop? Also, in your HTML, you need to make the name="url" to be name="url[]". Same for label. Link to comment https://forums.phpfreaks.com/topic/156608-web-page-maker-i-get-a-blank-page/#findComment-824619 Share on other sites More sharing options...
hchsk Posted May 3, 2009 Share Posted May 3, 2009 what he means is that you forgot a statement. if (this is true). . . . {do something!} otherwise, youre asking a question. . . and ignoring the answer, so why ask the question? Link to comment https://forums.phpfreaks.com/topic/156608-web-page-maker-i-get-a-blank-page/#findComment-824624 Share on other sites More sharing options...
music_fan01 Posted May 3, 2009 Author Share Posted May 3, 2009 Like this? $url = $_POST["url"]; for ($u=0; $u <7; $u++) { if ($url[$u] != "" and $label[$u] != ""){ { $urls = true; } Link to comment https://forums.phpfreaks.com/topic/156608-web-page-maker-i-get-a-blank-page/#findComment-824629 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.