how to include href in php

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
phpclueless
Forum Newbie
Posts: 2
Joined: Thu Jul 24, 2008 10:10 am

how to include href in php

Post by phpclueless »

I am just tweaking php that was provided to me, but i dont really understand its workings at all. i would like to add a link to go back to the website, but i cant get it to work. something like:
<a href="www.myurl.com">Continue Shopping!</a>

here is my code (and any help will be much appreciated!)

<?php

//change these settings
$to = "me@me.com";
$subject = "Order from ".$_GET['cname'];
$headers = 'From: me@me.com' . "\r\n" .
'Reply-To: me@me.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();



error_reporting(E_ALL);
include_once ('connect.php');
$qq="SELECT id, manufacturer, product, size, price from products";
$result=mysql_query($qq);
$mbody="\nTHANKS FOR YOUR ORDER!\n\n";
$mbody.="ORDER SUMMARY:\n";
$mbody.="Name: ".$_GET['cname']."\n";
$mbody.="Phone: ".$_GET['cphone']."\n";
$mbody.="Email: ".$_GET['cemail']."\n";
$mbody.="Address: ".$_GET['caddress']."\n";
$mbody.="\n--------------------------------------------\n";
$total=0;
while ($row = mysql_fetch_assoc($result)) {

$idw=$row['id'];
if ($_GET["i$idw"]>=1) {
$mbody.=$_GET["i$idw"]." quantities of #".$row['id']."\nManufacturer: ".$row['manufacturer']."\nProduct: ".$row['product']."\n Size: ".$row['size']."\n Price: $".$row['price']." each"."\n-------------------------------------------\n";
$total+=$row['price']*$_GET["i$idw"];
}
}
$mbody.="\nTOTAL: \$ $total\n";

echo nl2br($mbody);


if (mail($to, $subject, $mbody, $headers)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}

?>
Paul Arnold
Forum Contributor
Posts: 141
Joined: Fri Jun 13, 2008 10:09 am
Location: Newcastle Upon Tyne

Re: how to include href in php

Post by Paul Arnold »

Are you wanting to display the link on the page or in the email?

I'm assuming on the page.
Just include the line in your echo.

Try this...


Change

if (mail($to, $subject, $mbody, $headers)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}


To

if (mail($to, $subject, $mbody, $headers)) {
echo("<p>Message successfully sent!</p><p><a href=\"www.myurl.com\">Continue Shopping!</a></p>");
} else {
echo("<p>Message delivery failed...</p><p><a href=\"www.myurl.com\">Continue Shopping!</a></p>");
}
phpclueless
Forum Newbie
Posts: 2
Joined: Thu Jul 24, 2008 10:10 am

Re: how to include href in php

Post by phpclueless »

it worked!! thanks a lot.
Post Reply