Page 1 of 1

how to include href in php

Posted: Thu Jul 24, 2008 10:13 am
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>");
}

?>

Re: how to include href in php

Posted: Thu Jul 24, 2008 10:24 am
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>");
}

Re: how to include href in php

Posted: Thu Jul 24, 2008 11:09 am
by phpclueless
it worked!! thanks a lot.