Jump to content

A link in email (PHP)


farah

Recommended Posts

Hi there,

In my web site I have a form, when the user enter name, email address by clicking on submit button it bring thank you page, in this page it asked the user to check their email address and click on the link in the email to verify the information. So far I could go as far as it replies to the user with the name and the link to verify but I cannot activate the link. It shows page is not found, the directory of the page is right. I want the user check information and then click on the submit button, when user push submit it automatically send me email with the information (name & email). How can I do that? It sounds easy, but I cannot figure it out. I appreciate if someone helps me.

Link to comment
https://forums.phpfreaks.com/topic/124606-a-link-in-email-php/
Share on other sites

Here is the first page. I appreciate your time.

 

<?php

 

if (@$_POST['submitted']) {

$fl_name = @$_POST['name'];

  $email = @$_POST['email'];

  $addr = @$_POST['addr'];

  $City = @$_POST['City'];

  $State = @$_POST['State'];

  $Zip = @$_POST['Zip'];                       

 

// if magic quotes on, remove Magic Quotes effect

if ( get_magic_quotes_gpc() ) { // no arg needed - returns 1 if magic quotes are on, else 0

  ////print "magic quotes are on";

  $fl_name = stripslashes($name);

  $email = stripslashes($email);

  $addr = stripslashes($addr);

          $City = stripslashes($City);

          $State = stripslashes($State);

          $Zip = stripslashes($Zip);

}

 

$error_msg=array(); // intialize array

 

 

if ($name=="") { // test

 

$error_msg[]="Please enter your name";

 

}

 

if ($email=="") {

 

$error_msg[]="Please enter your email"; // add to the array

 

}

if ($addr=="") {

 

$error_msg[]="Please enter your address!";

 

}

 

$destination_email=$email;                //applicant’s email

$email_subject="Subject ";

//$email_body = "$name\n$addr\n$City\n$State\n$Zip\n$email"; 

 

$email_message =  "Dear {$name},\n\n" . "Thank you for …….  In order to active your account please clicks on the link below: \n\n".

"http://www.......page.php". "\n\n\n" . "Kind Regards,";                            //THIS LINK IS NOT WORKING

 

$email_body = mail($email, $email_subject, $email_message);

 

 

 

if  (!$error_msg) {

    // PHP's mail function

  mail ($destination_email, $email_subject, $email_body);

// to a new page

header ('Location: http://.........php');  //thank you page

  exit();

  ob_flush();

}   

 

}      //end of if post submitted

 

?>

 

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Email</title>

</head>

  <div id="content">

  <form action="<?php $_SERVER['PHP_SELF'] ?>" method="POST">

     

      <h2>Heading.</h2>

<?php

if ($error_msg) {

echo "<ul>\n";

 

  foreach ($error_msg as $err) {

 

  echo "<li>".$err."</li>\n";

  }

echo "</ul>\n"; 

 

}

?>

<label for="name" >Name*</label><br />

      <input name="name" type="text" size="40" id="name" value="<?php echo $name ?>" /><br />

      <label for="email">Email*</label><br />

      <input name= "email" type="text" size="20" id="email" value="<?php echo $email ?>" /><br />

          <label for "addr">Address</label><br />

  <input name="addr" type="text" size="40" id="addr" value="<?php echo $addr ?>" /><br />

          <label for "City">City</label><br />

          <input name="City" type="text" size="20" id="City" value="<?php echo $City ?>" />

<br />

          <label for "State">State</label><br />

          <input name="State" type="text" size="2" id="State" value="<?php echo $State ?>" /><br />

          <label for "Zip">Zip</label><br />

          <input name="Zip" type="text" size="10" id="State" value="<?php echo $Zip ?>" /><br />

 

<input type="submit" name="submitted" value="Submit" />

</form>

  </div>

</html>

<a href="index.php"> return to previous page</>

<?  bottom(); ?>

 

 

Link to comment
https://forums.phpfreaks.com/topic/124606-a-link-in-email-php/#findComment-644880
Share on other sites

I tried different things, for example after they click on the link it supposed to show this page (below) to verify the info but still it didn’t show it even thought I think my directory was right ( my domain name + the root to the page i.e. http://www.mywebsite/emailfolder/verification.php).  Do you have better idea for it? Thanks for your help.

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Confirmation</title>

<link type="text/css" media="screen" href="../css/codin_styles.css" />

</head>

<?

function display($name, $email, $addr, $City, $State, $Zip)

{

echo "<div style='text-align: center'>";

echo "<form action=signup-po-web.php? method='post'>"

<p><b>$name</b></br>

$email</br>

$addr<br>

$city<br>

$state<br>

$zip</p>;

}

 

?>

 

Link to comment
https://forums.phpfreaks.com/topic/124606-a-link-in-email-php/#findComment-645098
Share on other sites

  • 2 weeks later...

Hi there,

I already created a log in page; after subscriber fill information and submit it; it sends back an email to the subscriber with thank you note and a confirmation link.

$link = "http://www.mytestsite/confirm.php?name=$name&addr=$addrs&city=$City&state=$State&zip=$zip";

$email_body = "Thank you ... In order to active your account please clicks on the link below:

          \n\n $link \n\n Kind Regards," 

 

How can I make, after subscriber click on the link, it send me an email with the subscriber name, address and other info on the link? Is it doable without using database? I'm totally lost in this part, I don't know where should I look for a help. I appreciate if somebody could help me.

 

Thanks,

 

Link to comment
https://forums.phpfreaks.com/topic/124606-a-link-in-email-php/#findComment-655774
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.