Jump to content

Hyperlinking Question


randalw

Recommended Posts

I new to PHP. Following is my code. I need my submit button, once the form is filled and they hit submit to go to the following website [a href=\"http://www.gasmoneysaver.net\" target=\"_blank\"]http://www.gasmoneysaver.net[/a]

Can you tell me what the code should be to make this happen?

CODE:

<?php
if ($_POST['first_name'] != "" && $_POST['last_name'] && $_POST['phone'] && $_POST['email'] && $_POST['state'] ) {
$subject="GC Form";
$ip=$_SERVER["REMOTE_ADDR"];
$host = $ip;
$mon=date(m);
$day=date(j);
$year=date(y);
$hour=date(g);
$min=date(i);
$sec=date(s);
$hour=$hour-2;
if($hour<=0) { $hour+=12; }
$ts = "$hour:$min:$sec on $day/$mon/$year";


$to="randal@500kmentor.com";

$body="

First Name = $first_name

Last Name = $last_name

Phone = $phone

Email Address = $email

State = $state


Host: $host
Time: $ts";

$email = "From: Form <$to>";
mail($to, $subject, $body, $email);
?>

<html>
<head>
<title>Email Sent</title>
</head>
<body bgcolor="#ffffff" text="#666666">

<p>&nbsp;</p>
<center>
<table border="1" cellpadding="3" cellspacing="0" width="400" bordercolor="#919191" bgcolor="#E6E6E6">
<tr>
<td width="100%">
<p><center><b><font color="#000000">Email was successfully sent to: <?php echo $to ?></font></b></center>

</td>
</tr>
</table>

</body>
</html>

<?php
} else {
?>

<html>
<head>
<title>Contact email error</title>
</head>

<body bgcolor="#ffffff" text="#666666">
<p><center>
<table border="1" cellpadding="3" cellspacing="0" width="400" bordercolor="#919191" bgcolor="#E6E6E6">
<tr>
<td width="100%">
<center>
<b>There was an error with processing the email.</b><br>
<p>
<font color="#FF0000">Errors where:</font><br>
<?php
If (!$_POST['first_name'])
echo "First Name field is empty<br>";

If (!$_POST['last_name'])
echo "Last Name field is empty<br>";

If (!$_POST['phone'])
echo "Phone field is empty<br>";

If (!$_POST['email'])
echo "Email Address field is empty<br>";

If (!$_POST['state'])
echo "State field is empty<br>";

?>
<p>
Email message wasn't sent

</td>
</tr>
</table>
</body>
</html>

<?php
}
?>
Link to comment
Share on other sites

Do you own that site? if not i dont think there is a way that you can post data to it because you need to add code to that site so that it can recieve the data. Or do u just want that site to open without posting data to it?

I just had a look and your name is on the site so i guess you do own it. Do you want to go to that site instead of displaying "Email was successfully sent to: <?php echo $to ?>" or instead of that?
Link to comment
Share on other sites

[!--quoteo(post=350412:date=Feb 28 2006, 04:26 PM:name=php_b34st)--][div class=\'quotetop\']QUOTE(php_b34st @ Feb 28 2006, 04:26 PM) [snapback]350412[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Do you own that site? if not i dont think there is a way that you can post data to it because you need to add code to that site so that it can recieve the data. Or do u just want that site to open without posting data to it?

I just had a look and your name is on the site so i guess you do own it. Do you want to go to that site instead of displaying "Email was successfully sent to: <?php echo $to ?>" or instead of that?
[/quote]

If the form is successful I want to go to www.gasmoneysaver.net I do not care if it displays iformation after the submit button. All I care about is it going to my website and emailing me the form data (which works fine now)
Link to comment
Share on other sites

[!--quoteo(post=350617:date=Mar 1 2006, 08:22 AM:name=randal)--][div class=\'quotetop\']QUOTE(randal @ Mar 1 2006, 08:22 AM) [snapback]350617[/snapback][/div][div class=\'quotemain\'][!--quotec--]
If the form is successful I want to go to www.gasmoneysaver.net I do not care if it displays iformation after the submit button. All I care about is it going to my website and emailing me the form data (which works fine now)
[/quote]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.