Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP form redirect

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #26973
    rjmccollam
    Participant

    I am using Chris’s simple form on a wordpress site for one of my clients. Normally in the contactengine.php file I just put a file like index.html for the redirect. For the wordpress site I cannot do that. I have tried putting in the directory (ie, /contact/) as well as the full url, but after a form is submitted wordpress pulls up a 404 Not Found page.

    Here is the contactengine.php code:

    Code:
    “;
    exit;
    }

    // prepare email body text
    $Body .= “Email: “;
    $Body .= $Email;
    $Body .= “n”;

    // send email
    $success = mail($EmailTo, $Subject, $Body, “From: <$EmailFrom>“);

    // redirect to success page
    if ($success){
    print ““;
    }
    else{
    print ““;
    }
    ?>

    Any help would be appreciated, not a PHP wizard. In case you need it the website is trading-strategy.com, and it is currently down right now because said client made a boo-boo.

    #67647
    cybershot
    Participant

    try this..not a php expert either. might work

    Code:
    “;
    exit;
    }

    // prepare email body text
    $Body .= “Email: “;
    $Body .= $Email;
    $Body .= “n”;

    // send email
    $success = mail($EmailTo, $Subject, $Body, “From: <$EmailFrom>“);

    // redirect to success page
    if ($success){ ?>



    #68196
    jinfiesto
    Member

    This is a little wordpress quirk. Basically, except for the styles, referencing static files in your html doesn’t work properly when they reside in the theme directory. So instead, what you have to do is use this template tag

    Code:

    to denote the root of the theme directory, and then write the rest of your url from there.

    *Edit* I re-read your post and initially misunderstood. Robski is right, you’ll want to use header redirects.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.