Re: Contact form....
| From: | Adam Richardson | Date: | Mon, 26 Apr 2010 19:26:03 +0000 |
| Subject: | Re: Contact form.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-304631@lists.php.net to get a copy of this message | ||
On Mon, Apr 26, 2010 at 3:16 PM, Watson Blair <bestudios.wb@gmail.com>wrote:
> Hey guys, so ive coded a sucessfull contact form before, but for some
> reason
> this bit of code is giving me the run-arroundl....
>
> so my HTML end is:
>
>
> <form action="send.php" method="post"
> enctype="multipart/form-data">
> <table border="0" cellspacing="2"
> cellpadding="0">
> <tr><td style="text-align:left;"> Send E-mail to:
> </td>
> <td><input type="radio" name="to" value="
> bestudios.wb@gmail.com">General Information</td></tr>
> <tr><td></td><td><input type="radio"
> name="to" value="
> ajaganji@akwimemorial.org">Founder and President: Professor Ajagi Nji,
> Ph.D</td></tr>
> <tr><td></td><td><input type="radio"
> name="to" value="
> dtanwani@akwimemorial.org">Executive Secretary: Dorothy Tah
> Tanwani</td></tr>
> <tr><td style="text-align:left;"> Name: </td>
> <td><input type="text" name="name"
> size="40"></tr></td>
> <tr><td style="text-align:left;">Subject: </td>
> <td><input type="text" name="subject"
> size="40"/></td></tr>
> <tr><td style="text-align:left;">E-mail Address:
> </td>
> <td><input type="text" name="from"
> size="40"/></td></tr>
> <tr><td style="text-align:left;">Message:
> </td>
> <td><TEXTAREA NAME="message" COLS=31
> ROWS=7></TEXTAREA></td></tr>
> <tr><td></td><td
> style="text-align:center;">
>
> </td></tr>
> <tr><td colspan="2"
> style="text-align:right;"><input
> type="submit" value="Send E-mail" name="submit"
> /></td></tr>
> </form></table>
>
> and the file send.php is:
>
> <?php
>
> $subject =$_POST"subject";
>
> $message=$_POST"message";
>
> $name=$_POST"name";
>
> $from=$_POST"from"
>
> $mail_from=$_POST"from";
>
> $to =$_POST"to";
>
> $header = "From: {$name} < {$from} >";
>
> $send_contact=mail($to,$subject,$message, $header);
>
> if($send_contact){
> echo "Thank you for Contacting Us!";
> }
> else {
> echo "An error occurred while sending your message, review your information
> and please try again.";
> }
> ?>
>
> when i go to test it out all i get back is a blank screen with: ";
> $send_contact=mail($to,$subject,$message, $header); if($send_contact){ echo
> "Thank you for Contacting Us!"; } else { echo "An error occured while
> sending your message, review your information and please try again."; } ?>
> on it... when i take out the like "
> $header = "From: {$name} < {$from} >";" i just get a blank screen, but it
> dosen't send the e-mail.... i know i'm missing something really obvious,
> but
> i just can't see it.
> Thanks,
> Watson
>
Maybe you just miscopied, but are you missing the brackets on the post array
vars (e.g., $from=$_POST["from"]) ?
Adam
--
Nephtali: PHP web framework that functions beautifully
http://nephtaliproject.com