php - Site with 3 different forms and responses change? -
so working on site has 3 forms on it.
right now, 3 forms send same generic response admin of site , user filled out form using script called "nms formmail version 3.14c1
". script seems limited in being able send single response form(s).
what need this: pages html/php
, need able send specific email both user (based on email entry) , admin other data captured out of input fields on form. each form have specific different corresponding email.
currently, particular script pulls values name tag within html input , all. searches haven't revealed quick , straight forward way of doing this. hoping of have ideas here?
well follows. first html part. create form in have 3 categories against want send 3 different responses.
<form method=post action=redirectpage.php> <select name=category><option value=res1>response 1</option><option value=res2>response 2</option><option value=res3>response 3></option></select> <input type=text name=fullname> <input type=submit name=submit value=submit> </form>
so when form submitted page redirected redirectpage.php. on page tricks. firstly values of fields filled. in our case follows
$category = $_post['category']; $fullname = $_post['fullname'];
if aren't sure $_post feel free read here.
once have variables can have different responses different categories.
$mailmessage['res1'] = "hello response 1"; $mailmessage['res2'] = "hello response 2"; $mailmessage['res3'] = "hello response 3";
now use mail function send email. read more mail function here
$msg = $mailmessage[$category]; mail("someone@example.com","my subject",$msg);
the first line in last code select message based on category selected in form. , email someone@example.com subject 'my subject' , message selected in line 1.
i hope helps purpose , helps better understand how use basic functions of php. if need further assistance please let me know.
Comments
Post a Comment