Create link in PHP

Discussion in 'PHP' started by pioneer1, Dec 15, 2008.

  1. #1
    Hi there,

    This is part of a form to mail code.

    How can I put a link back to educat.html page after form info is captured and the "Your message has been successfully entered" has been generated in php page. The link will take the user to the homepage


    $success_sent_msg='<p align="center"><strong>&nbsp;</strong></p>
    <p align="center"><strong>Your message has been successfully sent to us<br>
    </strong> and we will reply as soon as possible.</p>
    <p align="center">A copy of your query has been sent to you.</p>
    <p align="center">Thank you for contacting us.</p>
    <p align="center"><a href="http://www.educat.co.za/index.html>Click here to go back</a></p>';

    Thanks
     
    pioneer1, Dec 15, 2008 IP
  2. zerxer

    zerxer Peon

    Messages:
    368
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $success_sent_msg='<p align="center"><strong>&nbsp;</strong></p>
    <p align="center"><strong>Your message has been successfully sent to us<br>
    </strong> and we will reply as soon as possible.</p>
    <p align="center">A copy of your query has been sent to you.</p>
    <p align="center">Thank you for contacting us.</p>
    <p align="center"><a href="http://www.educat.co.za/index.html>Click here to go back</a></p>
    <p align="center"><a href="http://www.educat.co.za/educat.html>Click here to go to the homepage</a></p>';
     
    zerxer, Dec 15, 2008 IP
  3. pioneer1

    pioneer1 Peon

    Messages:
    1,137
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #3
    no, not like that.

    How can I implement the echo or print command for link back to previous page

    Thanks
    :)
     
    pioneer1, Dec 17, 2008 IP
  4. chopsticks

    chopsticks Active Member

    Messages:
    565
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I still don't get it, lol. Could you be a little more specific?

    print('<a href="http://www.educat.co.za/educat.html">Click to go back to homepage?</a>');
    PHP:
     
    chopsticks, Dec 17, 2008 IP
  5. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #5
    maybe you want a refresh to that page?
     
    crivion, Dec 17, 2008 IP
  6. pioneer1

    pioneer1 Peon

    Messages:
    1,137
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The problem is the link is not visible after form data is posted.

    You only see the following on the webpage:
    I want the link back to the previous to appear below message, but it must be visible.

    Maybe there is something wrong with my code

     
    pioneer1, Dec 17, 2008 IP
  7. Yesideez

    Yesideez Peon

    Messages:
    196
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #7
    $success_sent_msg='<p align="center"><strong>&nbsp;</strong></p>
    <p align="center"><strong>Your message has been successfully sent to us<br>
    </strong> and we will reply as soon as possible.</p>
    <p align="center">A copy of your query has been sent to you.</p>
    <p align="center">Thank you for contacting us.</p>
    <p align="center"><a href="http://www.educat.co.za/contactus.html">Click here to go back</a></p>';
    PHP:
    Try changing that line - you're missing a " off the end of the URL itself.
     
    Yesideez, Dec 17, 2008 IP
  8. caribbean_hatch

    caribbean_hatch Peon

    Messages:
    19
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Right - you're missing a quote right at the end of this string:

    :cool:
     
    caribbean_hatch, Dec 17, 2008 IP
  9. kingc

    kingc Member

    Messages:
    16
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    36
    #9
    I have a script that does this...

    I forget where I found it; but the lady who wrote it has her name In the notes; I kept them of course... right thing to do.

    Copyright ©2005, email script by Christine M. R.

    It's a php script made to Send email forms/captures - you plug in all your values, email, etc... and in it she defines 2 Variables.

    
    $thankyou .= 'your stuff here';
    
    //page to continue to
    $continue = "pageyouwant.php";
    
    // And then, we're done!
    PHP:
    Then, in the HTML ... displayed only when the form has been sent is...

     <a href="<?php print "$continue"; ?>"><h3>Click here to continue</h3></a>
    HTML:
    this of course, displays a header "click here to continue" that links to the value you put in the $continue variable.

    So quick run down.

    1. you have your page with the form on it - the form is set to execute ThisScript.php
    2. ThisScript.php has all of the email code in it; and defines a few variables at the end - (defined above the header)
    3. in the Body of ThisScript.php is your normal html code, body tags, etc... along with whatever you want displayed on that page - Including a link TO the page you want people going to.

    Hope i didn't confuse ... hope this helps.
     
    kingc, Dec 18, 2008 IP
  10. pioneer1

    pioneer1 Peon

    Messages:
    1,137
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Thanks, but where do I get this script and how do I implement it?
     
    pioneer1, Dec 18, 2008 IP
  11. zerxer

    zerxer Peon

    Messages:
    368
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #11
    You don't really need that script (unless you don't even have any PHP code to send the email yet). You only need to fix your output HTML like the couple above posts mentioned, which I'll put here:

    $success_sent_msg='<p align="center"><strong>&nbsp;</strong></p>
    <p align="center"><strong>Your message has been successfully sent to us<br>
    </strong> and we will reply as soon as possible.</p>
    <p align="center">A copy of your query has been sent to you.</p>
    <p align="center">Thank you for contacting us.</p>
    <p align="center"><a href="http://www.educat.co.za/index.html">Click here to go back</a></p>
    <p align="center"><a href="http://www.educat.co.za/educat.html">Click here to go to the homepage</a></p>';
    PHP:
    You were just missing the closing quotation " at the end of your <a> tag, which made it all get hidden.
     
    zerxer, Dec 18, 2008 IP