Hello Guys,

I would like to know if its possible or not, where i can have a text box which when i enter the ID and press submit it gets the email matching that ID. and sends an email, please note that i know how to send email, i just dont know how to get data and send it can someone please give me an example on how i would do this. THank you

Have a good day

Recommended Answers

All 3 Replies

I'm not sure what you need: the HTML form, the SQL statement or the PHP to run it? or do you just want to pass?

Hello,

I have a form when everytime i fill, it gives a unique id for example

name
surename
address
postcode
email@email.com
ID: 4

name
surename
address
postcode
email1@email.com
ID: 5

name
surename
address
postcode
email2@email.com
ID: 6

I then want a text box on say page called email.php

is like this

----------------
5 |
--------------- submit

when i click on submit, it goes to server and finds the email for record 5 and sends an email.

I hope that makes sense, thank you

have a good day

<?php

if($_POST['submit'] == "Send Email")
{
    $sql = "Select * from tablename where id=".$_POST['id'];
    $res = mysql_query($sql);
    $data = mysql_fetch_array($res);

    $to_email = $data['email'];

    //Send mail here
    // mail($to_email,$subject,$msg);
}

?>
<form name="frmEmail" action="" method="post">
<input type="text" name="id" id="id" />
<input type="submit" name="submit" id="submit" value="Send Email" />
</form>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.