Re: still some problems with contact form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx> 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@xxxxxxxxx>
> To: <php-general@xxxxxxxxxxxxx>
> Sent: Tuesday, July 19, 2005 5:52 PM
> Subject:  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@xxxxxxxxx";
> $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::

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux