...

View Full Version : How do you echo a html hyperlink?



xdous
03-04-2009, 10:17 AM
Can anyone show me how to echo a html hyperlink?

abduraooft
03-04-2009, 10:31 AM
echo '<a href="http://google.com">Google</a>'; or

echo "<a href=\"http://google.com\">Google</a>";

xdous
03-04-2009, 11:03 AM
Thanks for these abduraooft, can you tell me a way to implement either of these methods into the below code. I would like the link after the last </h6> tag if possible :



echo "<h6>Use Back - Enter valid e-mail</h6><br />\n";
$badinput = "<h6>Your enquiry was not submitted.</h6><br />\n";
echo $badinput;
die ("<h6>Please click the back button and then complete all fields marked with an *.<br /><br />Thank you.</h6> ");
}

sea4me
03-04-2009, 05:13 PM
echo "<h6>Use Back - Enter valid e-mail</h6><br />\n";
$badinput = "<h6>Your enquiry was not submitted.</h6><br />\n";
$badinput .= '<a href="#" onClick="history.go(-1)">Back</a>';
echo $badinput;
die ("<h6>Please click the back button and then complete all fields marked with an *.<br /><br />Thank you.</h6> ");
}

That will add the hyperlink back after Your enquiry was not submitted.

You can change the href or leave it (both will work fine)

xdous
03-05-2009, 10:27 AM
Thanks for your reply sea but this does not seem to work? Do you have any other ideas?

kokjj87
03-05-2009, 10:30 AM
There is an extra bracket, remove it and you are fine.


echo "<h6>Use Back - Enter valid e-mail</h6><br />\n";
$badinput = "<h6>Your enquiry was not submitted.</h6><br />\n";
$badinput .= '<a href="#" onClick="history.go(-1)">Back</a>';
echo $badinput;
die ("<h6>Please click the back button and then complete all fields marked with an *.<br /><br />Thank you.</h6> ");
} //remove this extra bracket

xdous
03-05-2009, 10:35 AM
Hi kokjj87, I need that bracket, please see full code below:


<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$visitorcompany = $_POST['visitorcompany'];
$visitornumber = $_POST['visitornumber'];
$visitoradd1 = $_POST['visitoradd1'];
$visitoradd2 = $_POST['visitoradd2'];
$visitoradd3 = $_POST['visitoradd3'];
$visitorpostcode = $_POST['visitorpostcode'];
$notes = $_POST['notes'];
$attn = $_POST['product'];


if (eregi('http:', $notes)) {
die ("<h6>This form does not allow submissions of hyperlinks or code so please go back and remove such text.</h6> ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h6>Use Back - Enter valid e-mail</h6><br />\n";
$badinput = "<h6>Your enquiry was not submitted.</h6><br />\n";
echo $badinput;
die ("<h6>Please click the back button and then complete all fields marked with an *.<br /><br />Thank you.</h6> ");
}

if(empty($visitor) || empty($visitormail) || empty($notes ) || empty($product )) {
echo "<h6>Your enquiry was not submitted.</h6><br />\n";
die ("<h6>Please click the back button and then complete all fields marked with an *.<br /><br />Thank you.</h6>");
}

$todayis = date("l, F j, Y, g:i a") ;

$product = $product ;
$subject = $product;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Product required: $product \n
Quote details: $notes \n
From: $visitor ($visitormail)\n
Company name: $visitorcompany \n
Phone number: $visitornumber \n
Address line 1: $visitoradd1 \n
Address line 2: $visitoradd2 \n
Address line 3: $visitoradd3 \n
Postcode: $visitorpostcode \n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("emailaddressgoeshere", $subject, $message, $from);

?>

kokjj87
03-05-2009, 10:42 AM
An example of how to print the hyperlink..
Note that you can use '\' to escape the quote


echo "<h6>Please click the <a href=\"#\" onClick=\"history.go(-1)\">back</a> button and then complete all fields marked with an *.<br /><br />Thank you.</h6> ";

Full code


<?php

$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$visitorcompany = $_POST['visitorcompany'];
$visitornumber = $_POST['visitornumber'];
$visitoradd1 = $_POST['visitoradd1'];
$visitoradd2 = $_POST['visitoradd2'];
$visitoradd3 = $_POST['visitoradd3'];
$visitorpostcode = $_POST['visitorpostcode'];
$notes = $_POST['notes'];
$attn = $_POST['product'];


if (eregi('http:', $notes)) {
die ("<h6>This form does not allow submissions of hyperlinks or code so please go <a href=\"#\" onClick=\"history.go(-1)\">back<a/> and remove such text.</h6> ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h6>Use Back - Enter valid e-mail</h6><br />\n";
echo "<h6>Your enquiry was not submitted.</h6><br />\n";

die ("<h6>Please click the <a href=\"#\" onClick=\"history.go(-1)\">back</a> button and then complete all fields marked with an *.<br /><br />Thank you.</h6> ");
}

if(empty($visitor) || empty($visitormail) || empty($notes ) || empty($product )) {
echo "<h6>Your enquiry was not submitted.</h6><br />\n";
die ("<h6>Please click the <a href=\"#\" onClick=\"history.go(-1)\">back<a/> button and then complete all fields marked with an *.<br /><br />Thank you.</h6>");
}

$todayis = date("l, F j, Y, g:i a") ;

$product = $product ;
$subject = $product;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
Product required: $product \n
Quote details: $notes \n
From: $visitor ($visitormail)\n
Company name: $visitorcompany \n
Phone number: $visitornumber \n
Address line 1: $visitoradd1 \n
Address line 2: $visitoradd2 \n
Address line 3: $visitoradd3 \n
Postcode: $visitorpostcode \n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";

$from = "From: $visitormail\r\n";


mail("emailaddressgoeshere", $subject, $message, $from);

?>

xdous
03-05-2009, 10:53 AM
Thanks very much kokjj87 this has worked :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum