Jump to content

web page maker- I get a blank page


music_fan01

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.