Black Response

Reply

Join Date: Mar 2005
Posts: 30
Reputation: crestaldin is an unknown quantity at this point 
Solved Threads: 0
crestaldin crestaldin is offline Offline
Light Poster

Black Response

 
0
  #1
Feb 4th, 2007
Hello All,

I am a PHP newbie and have all my resources set up( by that I mean PHP,Apache server etc all working fine)

I have an html file and a PHP script to handle the inputs from the html form. However when I hit submit to send the data to the PHP script I get a blank page.

Below are my files.

[code = php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/2000/REC -xhtml1-20000126/DTD/xhtml1-transitional.dtd">

<html xmlns ="http://www.w3.org/1999/xhtml" xml :lang="en" lang ="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>HTML Form</title>
</head>

<body>

<!--Script 2.1 -from.html -->

<form action = "handle_form.php " method="post">

<fieldset><legend> Enter you information in the form below :</legend>
<p><b>Name :</b> <input type = "text" name = "name" size ="20" maxlength = "40"/></p>

<p><b>Email :</b> <input type = "text" name ="email" size="40" maxlength ="40"/></p>

<p><b>Gender :</b> <input type = "radio" name ="gender" value ="M" />Male
<input type = "radio" name ="gender" value ="F" />Female
</p>
<p><b>Age :</b>
<select name = "age" >
<option value ="0-30">Under 30</option>
<option value ="30-60">Between 30 and 60</option>
<option value ="60+">Over 60 </option>
</select></p>
<p><b>Comments :</b><textarea name = "comments" rows ="3" cols="50"></textarea></p>
</fieldset>

<div align = "center"><input type = "submit" name ="submit" value ="Submit Information"/><div>

</form>
[/code]


****...and here is the PHP script handling the form above*************

[code = php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/2000/REC -xhtml1-20000126/DTD/xhtml1-transitional.dtd">

<html xmlns ="http://www.w3.org/1999/xhtml" xml :lang="en" lang ="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>Form Feedback</title>
</head>

<body>

<? php # Script 2.2 -handle_form.php

echo "<p> Thank you ,<b>$name</b> for the following comments :<br/><tt>$comments</tt><p>We will reply to you at <i>$email</i>.</p>";

?>

</body>

</html>
[/code]

I'd be grateful if some can explain why the handle_form.php shows up BLANK when I clik submit from the form.html.

Thank You.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 10
Reputation: azarudeen is an unknown quantity at this point 
Solved Threads: 0
azarudeen azarudeen is offline Offline
Newbie Poster

Re: Black Response

 
0
  #2
Feb 5th, 2007
Originally Posted by crestaldin View Post
Hello All,

I am a PHP newbie and have all my resources set up( by that I mean PHP,Apache server etc all working fine)

I have an html file and a PHP script to handle the inputs from the html form. However when I hit submit to send the data to the PHP script I get a blank page.

Below are my files.

[code = php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/2000/REC -xhtml1-20000126/DTD/xhtml1-transitional.dtd">

<html xmlns ="http://www.w3.org/1999/xhtml" xml :lang="en" lang ="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>HTML Form</title>
</head>

<body>

<!--Script 2.1 -from.html -->

<form action = "handle_form.php " method="post">

<fieldset><legend> Enter you information in the form below :</legend>
<p><b>Name :</b> <input type = "text" name = "name" size ="20" maxlength = "40"/></p>

<p><b>Email :</b> <input type = "text" name ="email" size="40" maxlength ="40"/></p>

<p><b>Gender :</b> <input type = "radio" name ="gender" value ="M" />Male
<input type = "radio" name ="gender" value ="F" />Female
</p>
<p><b>Age :</b>
<select name = "age" >
<option value ="0-30">Under 30</option>
<option value ="30-60">Between 30 and 60</option>
<option value ="60+">Over 60 </option>
</select></p>
<p><b>Comments :</b><textarea name = "comments" rows ="3" cols="50"></textarea></p>
</fieldset>

<div align = "center"><input type = "submit" name ="submit" value ="Submit Information"/><div>

</form>
[/code]

****...and here is the PHP script handling the form above*************

[code = php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN " "http://www.w3.org/TR/2000/REC -xhtml1-20000126/DTD/xhtml1-transitional.dtd">

<html xmlns ="http://www.w3.org/1999/xhtml" xml :lang="en" lang ="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>Form Feedback</title>
</head>

<body>

<? php # Script 2.2 -handle_form.php

echo "<p> Thank you ,<b>$name</b> for the following comments :<br/><tt>$comments</tt><p>We will reply to you at <i>$email</i>.</p>";

?>

</body>

</html>[/code]

I'd be grateful if some can explain why the handle_form.php shows up BLANK when I clik submit from the form.html.

Thank You.
Hi,
you can do that functions in a single page itself
without doing two seprate pages.I have altered your code and i have given that below .you check that and if any doubt means ask upto my knowledge if know i will explain

the code

<html xmlns ="http://www.w3.org/1999/xhtml" xml :lang="en" lang ="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>HTML Form</title>
</head>
<?php
$name=$_REQUEST['name'];
$comments=$_REQUEST['comments'];
$submit=$_REQUEST['submit'];
if($submit)
{
$ee="Thank you $name for the following comments commentsWe will reply to you at $email";
}
?>
<body>
<!--Script 2.1 -from.html -->
<form action="" method="post">
<fieldset><legend> Enter you information in the form below :</legend>
<p><? echo $ee;?> </p>
<p><b>Name :</b> <input type = "text" name = "name" size ="20" maxlength = "40" value="<?=$name?>"/></p>
<p><b>Email :</b> <input type = "text" name ="email" size="40" maxlength ="40"/></p>
<p><b>Gender :</b> <input type = "radio" name ="gender" value ="M" />Male
<input type = "radio" name ="gender" value ="F" />Female
</p>
<p><b>Age :</b>
<select name = "age" >
<option value ="0-30">Under 30</option>
<option value ="30-60">Between 30 and 60</option>
<option value ="60+">Over 60 </option>
</select></p>
<p><b>Comments :</b><textarea name="comments" rows ="3" cols="50"><?=$comments?></textarea></p>
</fieldset>
<div align = "center"><input type ="submit" name="submit" value="submit"/><div>
</form>
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 30
Reputation: crestaldin is an unknown quantity at this point 
Solved Threads: 0
crestaldin crestaldin is offline Offline
Light Poster

Re: Black Response

 
0
  #3
Feb 11th, 2007
Originally Posted by azarudeen View Post
Hi,
you can do that functions in a single page itself
without doing two seprate pages.I have altered your code and i have given that below .you check that and if any doubt means ask upto my knowledge if know i will explain

the code

<html xmlns ="http://www.w3.org/1999/xhtml" xml :lang="en" lang ="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
<title>HTML Form</title>
</head>
<?php
$name=$_REQUEST['name'];
$comments=$_REQUEST['comments'];
$submit=$_REQUEST['submit'];
if($submit)
{
$ee="Thank you $name for the following comments commentsWe will reply to you at $email";
}
?>
<body>
<!--Script 2.1 -from.html -->
<form action="" method="post">
<fieldset><legend> Enter you information in the form below :</legend>
<p><? echo $ee;?> </p>
<p><b>Name :</b> <input type = "text" name = "name" size ="20" maxlength = "40" value="<?=$name?>"/></p>
<p><b>Email :</b> <input type = "text" name ="email" size="40" maxlength ="40"/></p>
<p><b>Gender :</b> <input type = "radio" name ="gender" value ="M" />Male
<input type = "radio" name ="gender" value ="F" />Female
</p>
<p><b>Age :</b>
<select name = "age" >
<option value ="0-30">Under 30</option>
<option value ="30-60">Between 30 and 60</option>
<option value ="60+">Over 60 </option>
</select></p>
<p><b>Comments :</b><textarea name="comments" rows ="3" cols="50"><?=$comments?></textarea></p>
</fieldset>
<div align = "center"><input type ="submit" name="submit" value="submit"/><div>
</form>
Thanks for the help....but the problems still persists and I'd try to see if something else is wrong.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 91
Reputation: ses5909 is an unknown quantity at this point 
Solved Threads: 0
ses5909 ses5909 is offline Offline
Junior Poster

Re: Black Response

 
0
  #4
Feb 11th, 2007
Your code probably has an error in it but you can't see it because error reporting is probably turned off. Put this at the top of your page:

error_reporting(E_ALL);

so see the errors.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 37
Reputation: jblacdao is an unknown quantity at this point 
Solved Threads: 3
jblacdao jblacdao is offline Offline
Light Poster

Re: Black Response

 
0
  #5
Feb 16th, 2007
Or if you just copy pasted azarudeen's code and didn't put in the page value for the action property in the form tag, you'll definitely get a blank page ^^
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC