Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: php help please

  1. #1
    Join Date
    Mar 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default php help please

    Hi this is probebly simple but I cant seem to get it right.

    php code for mail form

    PHP Code:
    if($send)
    {
    header"Location:http://www.example.com/thankyou.html");} 
    else
    {print 
    "We encountered an error sending your mail, 

    This all seems to work fine however once its directed to thankyou.html I
    would like it to print a thank you message I have tried several attempts but all failed...Many thanks for your help with this.

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    1. Make your code neat:
    PHP Code:
    if($send) {
      
    header("Location:http://www.example.com/thankyou.html");
    } else {
      print 
    "We encountered an error sending your mail, 
    2. What do you mean print a thank you message? Do you want to print it from the mail page? Or do you want to edit thankyou.html and on that page say: "Thanks for your spam!(haha)" or something like that?
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yes on the thankyou.html there a centered box that will display any errors or in this case a message thank you for contacting us! funny i tried to fix this );} when I do the script dont work

  4. #4
    Join Date
    Mar 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Heres the code incase u need


    PHP Code:
    <?php
    $to 
    $_REQUEST['sendto'] ;
    $from $_REQUEST['Email'] ;
    $name $_REQUEST['Name'] ;
    $headers "From: $from";
    $subject "Web Contact Data";

    $fields = array();
    $fields{"Name"} = "Name";
    $fields{"Email"} = "Email";
    $fields{"Message"} = "Message";

    $body "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }

    $headers2 "From: example.net";
    $subject2 "Thank you for contacting us";
    $autoreply "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.pokersaint.net";

    if(
    $from == '') {print "You have not entered an email, please go back and try again";}
    else {
    if(
    $name == '') {print "You have not entered a name, please go back and try again";}
    else {
    $send mail($to$subject$body$headers);
    $send2 mail($from$subject2$autoreply$headers2);
    if(
    $send)
    {
    header"Location: http://www.example.com/thankyou.html");} 
    else
    {print 
    "We encountered an error sending your mail, please notify webmaster@example.net"; }
    }
    }
    ?>

  5. #5
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Hmm... Why not put the centered box on the page above, and on thankyou.html is only when everything is good...
    Jeremy | jfein.net

  6. #6
    Join Date
    Mar 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    you can see it here if you like ...tell me what you think is best http://cardiffroyalcabs.com/4x4/index.html

    the mail form is at the bottom of the page

  7. #7
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    What page is the code you listed above from? contact.php?
    Jeremy | jfein.net

  8. #8
    Join Date
    Mar 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yes ........

  9. #9
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Ok, then I think my idea is fine.
    Jeremy | jfein.net

  10. #10
    Join Date
    Mar 2009
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    can you show me how to do this.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •