sending a link via email

hello coders,
i don’t really know coding but i am stubburn, i can search internet for days to find some useful codes on internet.

this time not worked well.

my company website is rebuilding on wordpress and my employer ask me to have something additional:

we have some device’s user manual in pdf format uploaded somewhere in our website… if someone wants to dowload it, we want to know his/her e-mail address, name, company…

so, i am searching for the code for some 3 days now. ended up here to ask you, please.

if it will help, this was the code i found searching closest to my needs.


<?

// database connection here (??)



if($_POST['submit'] && !empty($_POST['email']) && !empty($_POST['username'])):



  $query = "INSERT INTO wp_users SET username='".$_POST'username']."', email='".$_POST['email']."', phone='".$_POST['phone']."'";

  mysql_query($query) or die(mysql_error());



  $to = $_POST['email'];

  $subject = "Thank you for registering";

  $message = "Thank you for registering, ".$_POST['username'].",<br><br>here's a link to download the program:<br>

<a href='http://mywebsite.com/program.progextension'>http://mywebsite.com/program.progextension</a>

<br><br>Kind Regards,<br>The webmaster";



  mail($to, $subject, $message);



  echo "an email containing the download link has been sent";



elseif($_POST['submit']):

  echo "some fields were left blank";

endif;

?>

<html><body>

<form method="post">

Username: <input type="text" name="username"><br>

Phone: <input type="text" name="phone"><br>

Email: <input type="text" name="email"><br>

<input type="submit" name="submit" value="Send"></form>

</body>

</html>
Sponsor our Newsletter | Privacy Policy | Terms of Service