Forum Moderators: coopster

Message Too Old, No Replies

Selective Feedback Form

php onclick?

         

tenyears

5:43 pm on Mar 4, 2005 (gmt 0)

10+ Year Member



The site that I'm working on has a number of members who each want feedback sent to their own email address. I obviously don't want to create a form for each member, instead I want a visitor's click on a desired name to make that specific member's email address the one that the form uses.

After doing some reading I'm more lost than ever, my initial plan involved creating a page which contained an array of addresses. I am of course now questioning the whole idea as it was mostly based on using a function similar to onclick.

How would I go about creating such a thing, I already have the form, any help is much appreciated.

lZakl

6:50 pm on Mar 4, 2005 (gmt 0)

10+ Year Member



I sounds to me, like you could use php sendmail with a simple loop. In this loop, you would pull a text file, or a MYSQL query (whichever you feel suits you best), and sift through it with a while loop.

This would require three parts:

1) Your form: You say you already have it built. Have a select "drop down" with all you members names in it. The visitor selects the members name from the list, and enters their feedback, and submit.

2) Your text file,(or MYSQL database) containing a comma delimitered entry for each member. Each entry would look similar to this:

Zak,zak@yoursite.com

This would make it easy to enter, and subtract users.

3) Your PHP page. This would then take the members name (given from the form page) and asign it to a var;

$mem_name

At this point you would create a while loop to read through the text file and match the member name with a simple if..

if (preg_match("/$mem_name/i", "$while_var")
{
Split the comma delimitered string and strip the member name and comma from the string to be left with an email address. Asign that email address to a variable, and exit the while loop:
}

Now you are left with an email address to send the feedback to.

An additional note, you could also include this text file on your form page, and use the same type of loop to asign all the values to your SELECT box on your form. So all you have to do is add and subtract names from your file/database, and BOTH pages will never have to be edited.

Just my thoughts on the subject :0)

Good Luck!

-- Zak

P.S. If you don't understand my post, or need help with the actual "how to's" I'll be glad to help :0)

Oh, and crap... where are my manners! WELCOME TO WEBMASTERWORLD!