You are here: Passing Entered Variable Values « PHP Programming Language « IT news, forums, messages
Passing Entered Variable Values

Posted by bombardier on 03/11/07 07:00

I just switched ISPs and am in the process of moving all MySQL
databases and PHP scripts to the new ISP. I have some simple HTML
forms that post to simple PHP scripts that used to work with my old
ISP, but don't work on the new ISP. The entered values don't seem to
be passed to the PHP script.

Here's an example. This is a an email form:
<html>
<body>
<form action="bmail.php" method="post">
<font face = "Arial" size = 1>
<table>
<tr><td>Your name:*</td></tr>
<tr><td><input type=text name=fromname size=50></td></tr>
<tr><td>Your email address:*</td></tr>
<tr><td><input type=text name=fromemail size=50></td></tr>
<tr><td>Subject:</td></tr>
<tr><td><input type=text name=subjects size=50></td></tr>
<tr><td><textarea name="comments" rows="10" cols="80" wrap="on"></
textarea></td></tr>
</table>
<input type=submit value="Send"><input type=reset value="Reset"><br>
* Mandatory
</font>
</form>
</body>
</html>

Here's the PHP script that the form posts to:

<html>
<body>
<?
$toaddress = <my email>;
$subject = $subjects;
$mailcontent = $comments. "<br><br>"
. $fromname . "<br>";
$fromaddress = $fromemail;
if ( empty($fromemail) ) // email address mandatory
{
echo "<h1>";
echo "Your email address must be entered <br><br>";
echo "<a href = 'bmail.htm'>Return</a><br></h1>";
}
elseif ( empty($fromname) ) // name mandatory
{
echo "<h1>";
echo "Your name must be entered <br><br>";
echo "<a href = 'bmail.htm'>Return</a><br></h1>";
}
else
{
mail("$toaddress", "$subjects", "$mailcontent", "MIME-Version: 1.0\r
\nContent-Type:text/html; charset=iso-8859-1\r\nFrom: ". $youremail
. "\r\n");
echo "<h1>";
echo "Thank You for Your Email";
}
?>
</body>
</html>

The script parses fine. But it thinks that the $fromemail value is
empty and exits at the first "if" condition, when in fact a non-Null
value was entered on the form.

The version of PHP I'm currently using with the new ISP is 4.4.4. The
old ISP was using an older version.

Thanks in advance.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация