[SOLVED] Email php hyperlink

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jamrop
Forum Commoner
Posts: 80
Joined: Fri May 16, 2003 5:38 pm

[SOLVED] Email php hyperlink

Post by jamrop »

Not sure what i am doing wrong here. Automatically sending an email to a user confirming they have posted, and i make a hyperlink, but it does not want to work. Code below

Code: Select all

<?php

//header("Location: approve.php");
$headers = "MIME-Version: 1.0\n"; 

$headers .= "Content-type: text/html; charset=iso-8859-1\n"; 

$headers .= "From: info@De.co.uk <info@De.co.uk>\n";

$subject = "Approved";

$body ="<html><head></head><body>Thank you $approvename for posting at Der.  <br>

Your post title is <b>$title</b><br>

Your post reference is <b>E$advert_id</b>. Please keep a record of this. <br><br>

If you have any questions, please <a href=http://de.co.uk/contact/contact.php>click here</a><br><br>
Please do not reply to this email.
</body></html>";



mail($email, $subject,$body,$headers);


?>
Any ideas

Many thanks
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

what "doesnt work" ?

any errors?
jamrop
Forum Commoner
Posts: 80
Joined: Fri May 16, 2003 5:38 pm

Post by jamrop »

sorry

no errors, the user gets the email, but the hyperlink <a href> click here</a> is not clickable, just blue font
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

feyd | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]


use quotes

Code: Select all

&lt;a href="http://de.co.uk/contact/contact.php"&gt;click here&lt;/a&gt;
ALL html attribute values are supposed to use quotes

browsers try thier best to make up for html designers mistakes, but only so much can be done

tons of people thing this kinda stuff is ok:

Code: Select all

&lt;td align=left width=400&gt;
&lt;p class=red&gt;
&lt;select name=foobar&gt;
    &lt;option value=foo selected&gt;
&lt;/select&gt;
etc.... but its all incorrect. yes it may work in some browsers, but its a bad habit


this is how its supposed to be

Code: Select all

&lt;td align="left" width="400"&gt;
&lt;p class="red"&gt;
&lt;select name="foobar"&gt;
    &lt;option value="foo" selected="selected"&gt;Foo&lt;/option&gt;
&lt;/select&gt;

i think alot of people ditch the quotes because if using scripting like php, having to escape all the quotes is a pain.


feyd | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Last edited by rehfeld on Thu Oct 21, 2004 5:19 pm, edited 1 time in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Code: Select all

<?php
<?php

//header("Location: approve.php");
$headers = "MIME-Version: 1.0\n"; 

$headers .= "Content-type: text/html; charset=iso-8859-1\n"; 

$headers .= "From: info@De.co.uk <info@De.co.uk>\n";

$subject = "Approved";

$body ="<html><head></head><body>Thank you $approvename for posting at Der.  <br>

Your post title is <b>$title</b><br>

Your post reference is <b>E$advert_id</b>. Please keep a record of this. <br><br>

If you have any questions, please <a href='http://de.co.uk/contact/contact.php'>click here</a><br><br>
Please do not reply to this email.
</body></html>";



mail($email, $subject,$body,$headers);


?>
?>
jamrop
Forum Commoner
Posts: 80
Joined: Fri May 16, 2003 5:38 pm

Post by jamrop »

Many thanks
Post Reply