Grow your CSS skills. Land your dream job.

php Redirection

  • # November 17, 2008 at 5:09 pm

    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 = "salmple@gmail.com";
    $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

    # November 17, 2008 at 9:26 pm

    did you make a thankyou.html page. That’s where it’s redirecting to.

    print "<meta http-equiv="refresh" content="0;URL=thankyou.html">";

    # November 18, 2008 at 2:20 am

    here is my print in php if someone sends me a successful email:

    Code:
    print ““;

    change the URL and maybe the content="0; to some other number, I gave my code a complete URL

    uba
    # November 18, 2008 at 2:53 am

    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;
    # November 18, 2008 at 11:24 pm

    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 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".