Reply to Re: still some problems with contact form

Your name:

Reply:


Posted by Bruce Gilbert on 07/20/05 07:48

thanks, makes some sense.

so now where I have echo, I should have print? or just leave as echo
and add the else and ||?

Could you provide some sample code based on the code I posted
previously by chance??

being new to PHP I am sure I will run into errors for a few days, as is...

that would help me out greatly.



thx,

On 7/19/05, James <tuffguy@sympatico.ca> wrote:
> This is what you have done
>
> if(something happens) {
> print error;
> }
>
> print thanks for sending the form!
>
> So basically you are printing the error and then thanking them. You need to
>
> include an ELSE bracket. Like so..
>
> if(this error || that error || some other error) {
> print error;
> } else {
> //no errors, thank them!
> print THANKS!
> }
>
> ----- Original Message -----
> From: "Bruce Gilbert" <webguync@gmail.com>
> To: <php-general@lists.php.net>
> Sent: Tuesday, July 19, 2005 5:52 PM
> Subject: [PHP] still some problems with contact form
>
>
> Hello,
>
> on my web site contact form:
>
> http://www.inspired-evolution.com/Contact.php
>
> I am still having a few problems with the return results after filling
> out the form. Basically I am wanted to return an error msg. when all
> of the required fields are not filled out (those with a red *), and an
> invalid email address will also return an error.
>
> filling out all of the information correctly will result in a
> thank-you paragraph, we have received your submission etc.
>
> Right now even if you don't fill out the required fields, you still
> get my thank-you message for filling out the form correctly (as well
> as getting the error msg.). If someone has a chance try out the form
> yourself and you will see what I mean.
>
> What I would really like to have is a thank-you page when the form is
> completed sucussfully and an oops! page when there is an error. SO we
> are talking two different pages, based upon the results of the form
> information...
>
> The PHP code I have for the return info. currenty is:
>
> <?php
>
> $firstname = $_POST['firstname'];
> $lastname = $_POST['lastname'];
> $company = $_POST['company'];
> $phone = $_POST['phone'];
> $email = $_POST['email'];
> $email2 = $_POST['email2'];
> $URL = $_POST['URL'];
> $Contact_Preference = $_POST['Contact_Preference'];
> $Contact_Time = $_POST['Contact_Time'];
> $message = $_POST['Message'];
>
> if ((!$firstname) || (!$Contact_Preference)) {
>
> echo'<p><strong>Error!</strong> Fields marked <span class="red">
> *</span> are required to continue.</p><br />';
> echo'<p>Please go back to the <a href="Contact.php"title="Contact
> Me">Contact Me</a> page and try it again!</p>';
> }
>
> if
> (!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email))
> {
>
> echo '<p>Invalid email address entered.</p><br />';
> echo '<p>Please go back to the <a href="Contact.php" title="Contact
> Me">Contact Me</a> page and try it again!</p>';
> }
> if (($email) != ($email2)) {
>
> echo '<strong>Error!</strong> e-mail addresses dont match.<br />';
>
>
> }
>
> $email_address = "webguync@gmail.com";
> $subject = "There has been a disturbance in the force";
>
> $message = "Request from: $firstname $lastname\n\n
> Company name: $company\n
> Phone Number: $phone\n
> Email Address: $email\n
> URL: $URL\n
> Please Contact me via: $Contact_Preference\n
> The best time to reach me is: $Contact_Time\n
> I wish to request the following additional information: $Textarea";
>
> mail($email_address, $subject, $message, "From: $email \nX-Mailer:
> PHP/" . phpversion());
>
> echo "<p>Hello, <strong>$firstname</strong>.<br /><br />
> We have received your request for additional information, and will
> respond shortly.<br />
> Thanks for visiting inspired-evolution.com and have a wonderful day!<br
> /><br />
> Regards,<br /><br />
> <strong>Inspired Evolution</strong></p>";
>
> ?>
>
> any assistance/guidance is greatly appreciated. Thanks list!
>
> Bruce G.
> http://www.inspired-evolution.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
::Bruce::

[Back to original 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

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