Forum Moderators: coopster

Message Too Old, No Replies

Using MySQL to find id=email address for submitting a form

One form for multiple email addresses

         

lasko

4:12 pm on Jun 21, 2003 (gmt 0)

10+ Year Member



I have not really done any php programming before but have done some basic traning and reading with a little manipulation of free scripts from the Internet.

I can set up MySql tables and databases no problem.

I can make a php connect to a database no problem.

So now I want to create a program for my website which enables me to have the results sent from any form to the correct email address in Mysql.

For example the form id = 45 so the php program will access Mysql and find the id = 45 then collect the email address then send the form results to the email address selected.

I need this for my web site that has over 100 property owners all advertising. Their is no hurry but I want to learn php.

Can any one give me a few ideas and pointers on what will be required and which part of the whole process should i set up first.

I understand the Mysql databases should be created first and ready for testing your programs.

Any advice for beginner really appreciated

Cheers

misunderstood

4:50 pm on Jun 21, 2003 (gmt 0)

10+ Year Member



I have a contact form that displays the names from a database in a dropdown menu and on selection of the name it uses the email address corresponding to the name.
It is easy to amend to use id instead of name. Is this any good for you?

jaski

5:00 pm on Jun 21, 2003 (gmt 0)

10+ Year Member



I can make a php connect to a database no problem.

Next step would be to extract the email id you need from database ..

that is done by a select query.

eg.

$id = 45;

$query = "SELECT email_id from property_owners where id = $id";

$result = mysql_query($query);

list($email_id) = mysql_fetch_row($result);

this will give you email id in the variable $email_id.

You can then use "mail()" function in PHP to send email as required.

HTH
Jaski

lasko

6:24 pm on Jun 21, 2003 (gmt 0)

10+ Year Member



jaski

Thanks for that,

I am going to try that now and then see if i can start to build something up.

It sounds like a nice easy program to get me started in Php the only problem I have to think about is keeping my mind focused on making sure all veriables and strings are correct.

We all have to start somewhere!

Cheers

lasko

5:03 pm on Jun 22, 2003 (gmt 0)

10+ Year Member



After a little more messing about and reading some books I have managed to create my first ever proper script.

I could not find it on the internet so I created my own out of frustration. Now I have caught the bug to learn more and see how far I can push myself. What can I create next.

A simple script that connects to a database and finds the email address from the correct id submitted and the results are sent through email. Copies are sent to other specified email addresses with full or partial content from the form.

12 months ago I frowned at most php scripts because of Mysql, and now I have managed to overcome the nightmare.

Sorry for going on about it but its a success story for me and from the great people who post on Webmaster World.

Cheers

jatar_k

5:19 pm on Jun 22, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



glad to see you've finally see the light, lasko ;)