Forums

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

Home Forums Other php Redirection

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23594
    kevonGarcia
    Member

    hi i downloaded the code from chris and for some reason its not re directing my pages… I edited the come to suit my form here goes:

    <?php

    // CHANGE THE VARIABLES BELOW

    $EmailFrom = "sample limited";
    $EmailTo = "[email protected]";
    $Subject = "Contact Form Submission";

    $Name = Trim(stripslashes($_POST));
    $Email = Trim(stripslashes($_POST));
    $Number = Trim(stripslashes($_POST));
    $Reason =Trim(stripslashes($_POST));
    $Comment = Trim(stripslashes($_POST));

    // prepare email body text
    $Body = "";
    $Body .= "Name: ";
    $Body .= $Name;
    $Body .= "n";
    $Body .= "Email: ";
    $Body .= $Email;
    $Body .= "n";
    $Body .= "Number: ";
    $Body .= $Number;
    $Body .= "n";
    $Body .= "Reason: ";
    $Body .= $Reason;
    $Body .= "n";
    $Body .= "Comment: ";
    $Body .= $Comment;
    $Body .= "n";

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

    // redirect to success page
    // CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE
    if ($success){
    print "<meta http-equiv="refresh" content="0;URL=thankyou.html">";
    }
    else{
    print "<meta http-equiv="refresh" content="0;URL=error.html">";
    }
    ?>

    my html is:

    <form id="myform">
    <fieldset>

    <ul class="form">
    <li class="who"> <label for="form_name">Full Name</label><span class="required">Required</span>
    <input id="form_name" class="is_required" name="Name" type="text" /></li>

    <li class="email"> <label for="form_email">E-mail Address</label><span class="required">Required</span>
    <input id="form_email" class="vemail" name="Email" type="text" /></li>

    <li class="vphone"> <label for="form_number">Contact Number</label><span class="required">Required</span>
    <input id="form_number" class="is_required" name="Number" type="text" /></li>

    <li class="why"> <label for="form_reason">I’m sending this because</label><span class="required"></span>
    <select id="form_reason" class="is_required" name="Reason">
    <option>I’m interested in Design Services</option>
    <option>I want to Advertise on your site</option> </select></li>

    <li class="comments"> <label for="form_comment">Comments</label><span class="required">Required</span>
    <textarea id="form_comment" class="is_required" name="Comment"></textarea></li>

    <li class="submit"> <input id="send_contact" type="submit" value="Send" /></li>

    </ul>

    </fieldset>
    </form>

    i also validated the form using jquery, :) not the one supplied with the download and it works the validation and the general function of the form works well but its just the re direction of the page after the submit

    sigh… help me please

    #51240
    uba
    Member

    You can try another way instead of redirecting from the client side you can redirect it from the server using:

    Code:
    header(“Location: page_name.html”);
    exit;
    #51247
    kevonGarcia
    Member

    I took a break form my routine coding and I pondered and pondered then it hit me…. Well one things for sure i placed the Send.php file in my script folder on the server so it was giving me an error for some strange reason.I think it was could not find thankyou.html in Script folder So I placed it into the public folder of my server and it eliminated the error. in addition to that I forgot to specify <form id="myform" method="post" action="Send.php" id="myform"> within my contact page html. It works great now.

    A huge thank you to all the people who helped me I really appreciate it!!!

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