For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > April 2004 > I Nd HELP PLEASE html form to PHP - data gets lost









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author I Nd HELP PLEASE html form to PHP - data gets lost
P.Parker

2004-04-10, 6:31 pm

Hello all:
I'm new to PHP. I setup a html form say "form.html" It prompts the
user to fill in the fields: first name, email, & comments. Method is
set to post. Then when they hit submit it goes to the php form
"form.php" In the php form it is supposed to check to make sure all
fields were filled in. If a field wasn't filled in that field would be
displayed with a comment prompting the user to fill it in.

Anyway, after they fill in that field and hit submit I get the email
but the information from the "Comment" section is missing. If they
wrote a sentence I would get 1 word. If everything was filled out
properly on the html page I would get everything. What can I do to
resolve this? I know the info gets from the html to the php page b/c I
did a simple echo check for the comment right before the rest of the
php code and it all comes out there. After it gets validated its gone
=(. Here is all the php code from my php form.

<?php
if (($FName == "") || ($Email == "") || ($Comments == ""))
{
echo "<form name=form method=post>";
echo "<p class=bodymd align=center>Please make sure all required
fields are filled out.<br>";
echo "Fill in the ones you missed, they are listed below.<br></p>";
echo "<p class=bodymd align=center>If you do not want to use a Email
address type: <b>NA</b></p>";
}
if ($FName == "")
{
echo "<p class=bodymd>First Name<br><input type=text name=FName
size=36></p>";
}
else
{
echo "<input type=hidden name=FName value=$FName>";
}
if ($Email == "")
{
echo "<p class=bodymd>Email (username@domain.com)<br><input type=text
name=Email size=36></p>";
}
else
{
echo "<input type=hidden name=Email value=$Email>";
}
if ($Comments == "")
{
echo "<p class=bodymd>Comments or Questions<br><textarea name=Comments
rows=10 cols=50></textarea></p>";
}
else
{
echo "<input type=hidden name=Comments value=$Comments>";
}
if (($FName == "") || ($Email == "") || ($Comments == ""))
{
echo "<input type=submit name=Submit value=Submit>";
echo "<input type=reset name=Reset value=Clear Form>";
echo "</form>";
}
else
{
$message = "Name: $FName\nEmail: $Email\nComments: $Comments\n";
$extra = "From: $FName\r\nReply-To: $Email\r\n";
mail ("someuser@adomain.com", "subject anything", $message, $extra);
echo "<br>";
echo "<p class=bodymd align=center>Thanks for your inguiry,
$FName.<br>";
echo "A response will be sent to $Email as soon as possible.</p>";
}
?>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com