On Fri, 3 Apr 2009 15:08:45 -0400
"Gary" <[email protected]> wrote:
> This is driving me nuts. I am getting blank emails and the only
> information that is being passed to MySQL is the IP address.
>
> Can someone tell me what is wrong with this?
>
If this is in one file, as I assume it is, here's what is happening:
In browser type the URL.
Load page.
Show form.
Send email.
Echo.
Done
You should check if information is send and if it's not don't process
the $_POST cause the $_POST is empty.
Simplified:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<div id="important" style="visibility:hidden;">
<p>If you can see this, it's an anti-spam measure. Please don't
fill in the address field.</p>
<label for="address">Address</label>
<input type="text" name="address" id="address" /></div>
<label for="name">Name:</label>
<input name="name" type="text" /><br />
<label for="email">Email Address:</label>
<input name="email" type="text" />
<br />
<label for="name">Comments:</label>
<textarea name="comments" cols="50" rows=""></textarea>
<input name="submit" type="button" value="submit" /></form>
<?php
if ( isset( $_POST['submit'] ) ) {
// Receiving variables
$ip= $_SERVER['REMOTE_ADDR'];
... all other stuff
echo 'Thank you $name for submitting your inquiry!<br />';
echo 'You have supplied the following information:<br />';
echo 'Name: $name <br />';
echo 'Email Address: $email <br />';
echo 'Comments: $comments';
}
?>
--
Peter van der Does
GPG key: E77E8E98
IRC: Ganseki on irc.freenode.net
Blog: http://blog.avirtualhome.com
Forums: http://forums.avirtualhome.com
Jabber ID: [email protected]
GetDeb Package Builder
http://www.getdeb.net - Software you want for Ubuntu
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php