0

hi,
pls help me the following if feasible.

1. i have a file "tax.php"

<TR>
<td ALIGN = "left" valign = "top"> <b>ABC</b> <br> --ABC BG<br> <u>Address- </u>123 main st. Suite 307, Flushing, NY 11354<br>
<u>Phone </u>111-11-11<br><u>Email</u>- SOMEONE@DOMAIN.COM</td>
<td ALIGN = "left" valign = "top"> <b>ABC</b> <br> --SDFS BG<br> <u>Address- </u>123 main st. Suite 307, Flushing, NY 11354<br>
<u>Phone </u>111-11-11<br><u>Email</u>- SOMEONE2@DOMAIN.COM</td>
<td ALIGN = "left" valign = "top"> <b>ABC</b> <br> --AFDF DFSDF BG<br> <u>Address- </u>123 main st. Suite 307, Flushing, NY 11354<br>
<u>Phone </u>111-11-11<br><u>Email</u>- SOMEONE3@DOMAIN.COM</td>
</TR>

2. TAXFORM.PHP

<form name="myForm"
action="/Tax1mail.php" method="post">
<input type="hidden" name="subject" value="Form Submission" />
<input type="hidden" name="redirect" value="thankyou.html" />
Name: <input type="text" name="fname" />
Email: <input type="text" name="email" />
Phone No: <input type="text" name="phone" />
<input type="submit" name="submit" value="submit"/>
</form>

3. TAX1MAIL.PHP

ITS MAIL FUNCTION
<?php
$to = "SOMEONE1@SOMEONE.COM";
// it is best to have the email sent to a email that is part of the domain.
$subject = "Brought to you by Bengali";
$Sender = "SOMEONE@DOMAIN.com"; // set this to an email address on the domain where the email is coming from.
$EmailAd = "Email Address";
$Namee = "Name";
$Phon = "Phone";
$name = $_POST["fname"];

$email = $_POST["email"];
$phone = $_POST["phone"];
$message = "\r\nName = $name\r\nEmail = $email\r\nPhone = $phone"; // Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

// $headers .= "Reply-To: ".$email."\r\n";
$headers = "From: ".$Sender . "\r\n" .
'Reply-To: '.$email. "\r\n".
'X-Mailer: PHP/' . phpversion();

if (mail($to,$subject,$message, $header))
{echo("<p>Message successfully sent!</p>");
echo ( '<A href = "index.php">Home Page</A>' );}
else {echo("<p>Message delivery failed...</p>");}
?>

----------


user click a link which will open file1. file1 may have a list of 100 ppl with 100 diferent email addresses.
user wants to send an email to a person. now i hard coded each and every PERSON'S email in file1. but tht is not connected to file2 and 3.

requirement:

i want a user be able to click a link which will open file 2.
in file 2, he will submit the form
file 3 will send the email.

bad programming solution 1:
1. i can CUT person's email address from file1.
2. paste into file 3 . $TO = email address
3. also, IN file2, type action = /TAX1MAIL.PHP

that means if i have 100 email addresses in file1. i need 100 *2 = 200 files to do that. i beleive this is a bad program.

question? how can i solve this in better programming? i am trying to have one tax1mail.php and one taxform.php instead of 200. i am totally lost.

sorry if i confused you.

PLS ADVISE.

thx.

3
Contributors
10
Replies
11
Views
6 Years
Discussion Span
Last Post by diafol
0

Could you please use [ CODE ] tags? BTW your html is deprecated - some of those tags haven't been seen for a decade!

Edited by diafol: n/a

0

if i need to put it in database, i can use access db, mysql.
file1 may have 100 email address.
personA- email addresA
personB - email addresB
.......

how can i click email addresA link that will point to correct email in database, then connect to file2, file3.

I am a new php programmer. if u could give me details explanation as for how i can do it via database, i would be appreciate.

thanks.

0

> how can i click email addresA link that will point to correct email in database, then connect to file2, file3.

echo "<a href=\"mailto:{$row['email']}">{$row['username']}</a>";

THe file2/3 doesn't make any sense.

Look, if you're struggling with retrieving info from a DB, search for a tutorial.

0

echo "<a href=\"mailto:{$row}">{$row}</a>";

can u clarify the code pls?
not sure what is value of $row, email, user name?

I must need to hard coded the subject of the email? user cant change subject. so i used mail function which allows me to hard coded the subject.i am not sure i can hard code SUBJECT using mailto?

many thanks.

0

THe example was basic php from mysql recordset. No, you're right you can't use that from mailto. The mail() function will do that, but your question was unclear.

0

1. when user comes to my website, they look for a lawyer. Assuming i have the lawyer's email address.
2. once they find a lawyer, they need to send a message.
3. they click sendMESSAGE link, it will open a form to send message, they just need to enter name, email address, message. after they enter, hit submit.
they cant enter subject. subject will be controlled by me. i will have my own subject for all emails they send.
4. submit will link to mail.php to send the message. mail.php will send the email
5. lawyer get the email with the subject that i put in the code. in the body of his email, lawyer will see user's name, email, and message.

everything works fine for one lawyer.
if there are 100 lawyers and email addresses, how do i do it?
i used mailto. its easy to use. but i am not sure how i can have my own subject(ex: brought to you by me") using mailto. also problem with mailto is that if the user does not have client set up in his machine(ex-oulook), sendMESSAGE link not gonna work for him.

Thanks.

0

No forget mailto.

I'd have something like this:

$output="<table><thead><tr><th>Town</th><th>Lawyer</th><th>Contact</th></tr></thead><tbody>";
$r = mysql_query("SELECT id, chosenname, familyname, town, email FROM lawyers ORDER BY town, familyname, chosenname");

while($d = mysql_fetch_array($r)){
 $output .= "<tr><td>{$d['town']}</td><td>{$d['chosenname']} {$d['familyname']}</td><td><a href=\"getlawyer.php?id={$d['id']}\">Contact</a></td></tr>"; 
}
$output .= "</tbody></table>";

//at the appropriate place in the page
echo $output;

The GET bit:

if(isset($_GET['id'])){
  $id = $_GET['id'];
  //check this id exists in the db if so proceed otherwise head back to list page


}else{
 //head back to the list page
}

//make form with various fields and values
//include a hidden field with the $id (or it could be stored in a session variable)
//submit the form to a form handler page

The form handler page:

Use $_POST to pick up the data and send via mail()

0

you are so great. thanks a lot for your time.

i feel so embarrassed to tell you that i understood about 30% of what you doing.

Its been 2 weeks i started php. I dont have any db set up yet. I will save ur code and get some tutorial help.

Now i am not sure how i can use ur code.If you prefer to help me more, we can talk via messenger unless you can put all the steps in ur free time or i can start learning more. then get back to u. i kind of understand ur code but not understanding where i write all these codes.

its up to you whether you want to go deeper with me. it wuld be awesome help. i am desperate for the help.
if not, i have to study a lot first.

thanks a lot.

Safi

0

No PM/Messenger. Everything on forums. That way we all learn and if I make a mistake (and I often do), somebody can point it out. Also, anybody with better ideas can chip in - that way I learn too.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.