Re: php form help
- From: Tyrone Slothrop <ts@xxxxxxxxxxxxx>
- Date: Tue, 28 Nov 2006 06:40:57 -0800
On 28 Nov 2006 06:09:43 -0800, "liamo" <liam.lorigan@xxxxxxxxx> wrote:
Don't laugh lol I know your all php guru's : )
Ok, so I have little if any knowledge with the programming language php
- only having created small enquiry forms. Now I have a client that
needs a job order form with a little more function than having solely
contact details and a big enquiry text area.
The form I created in HTML is located at
http://www.ebesign.co.nz/projects/justfixit/job_order_form.html
and has used javascript to validate the fields against spammers etc but
now I am looking to process it all in a php form using the mail
function.
Basically I want my form to gather all the information including check
boxes, drop down menu's and to email it to my client - simple enough
request but I don't know the code and cannot find a worth while
tutorial or php resource ( most out there are simple forms without
drops downs, etc )
Any help, suggestions, or recommendations?
Much Appreciated netizens.
Liam
OK, I am not laughing but am somewhat amused, mostly because you have
a lot of learning ahead of you. ;-) I would imagine that there is a
time for learning and a time to finish a project and move on to the
next, so I offer a quick solution.
Primarily what you need to do is take all of those form vars and plug
them into the body of an email. Posting a form creates an array of
keys and values. Let's just return those to the email:
foreach ($_POST as $key=>$value) {
$bodyArr[] = "$key : $value";
}
$body = implode ("\n", $bodyArr);
mail ($to, $subject, $body, $headers);
So what I have done here is take every POST var, created an array of
values and keys, then added them to the body of the email with a
newline between each.
Of course, some of those vars you may not want to pass to the email,
so you can filter those out and capitalizing the keys would be nice:
$noSendArr = array ('submit');
foreach ($_POST as $key=>$value) {
if (!in_array ($key, $noSendArr) {
$bodyArr[] = ucwords($key)." : $value";
}
}
That should get you started. Good luck!
.
- References:
- php form help
- From: liamo
- php form help
- Prev by Date: php form help
- Next by Date: what is the meaning
- Previous by thread: php form help
- Next by thread: Re: php form help
- Index(es):
Relevant Pages
|