Re: What is wrong with this code
| From: | Gary | Date: | Fri, 03 Apr 2009 19:56:38 +0000 |
| Subject: | Re: What is wrong with this code | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-291048@lists.php.net to get a copy of this message | ||
Peter
I had the
if ( isset( $_POST['submit'] ) ) {
in there and it did not work.
I have used this on several sites, the only difference is that I was tyring
to contain it in one file. I also created a file just to process the POST,
but it still did not work.
I was thinkning it was something really simple like a mistyped word or
misplaced " or ' or ().
"Peter van der Does" <pvanderdoes@gmail.com> wrote in message
news:20090403154906.35844a8e@montecarlo.grandprix.int...
> On Fri, 3 Apr 2009 15:08:45 -0400
> "Gary" <gwpaul@ptd.net> 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: pvanderdoes@gmail.com
>
> GetDeb Package Builder
> http://www.getdeb.net - Software you want for Ubuntu