need help with html inside a php autoresponder

Discussion in 'PHP' started by saturn100, Jun 18, 2013.

  1. #1
    Hi
    I have a simple HTML form with a one off "thanks for your email" auto response
    However I want to place a link into the auto response and cant seem to place any HTML elements inside it

    The statement I want to place html into is this
    $autoreply = "Thanks for registering your details to confirm your participation in 2013s competition.Please click here for more info";
    PHP:
    I want to make "click here" a hyper link

    Is there any way to do this or work around

    Thanks
     
    saturn100, Jun 18, 2013 IP
  2. GMF

    GMF Well-Known Member

    Messages:
    855
    Likes Received:
    113
    Best Answers:
    19
    Trophy Points:
    145
    #2
    Have you tried escaping the double quotes?

    $autoreply = "Thanks for registering your details to confirm your participation in 2013s competition.Please <a href=\"link-goes-here.html\">click here</a> for more info";
    PHP:
     
    GMF, Jun 18, 2013 IP
    Devtard likes this.
  3. sorindsd

    sorindsd Well-Known Member

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    2
    Trophy Points:
    118
    #3
    you can use str_replace like this str_replace("click here",'<a href="link_to_replace">click here</a>',$autoreply);
     
    sorindsd, Jun 18, 2013 IP
  4. Devtard

    Devtard Notable Member

    Messages:
    850
    Likes Received:
    133
    Best Answers:
    4
    Trophy Points:
    220
    #4
    You can also use single quotes.

    echo '<a href="http://example.com">link</a>';
    PHP:
    Why use something that would result in using more resources? Not to mention that the code should be as simple as possible.
     
    Devtard, Jun 18, 2013 IP