Re: php form help



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!
.



Relevant Pages

  • php form help
    ... so I have little if any knowledge with the programming language php ... contact details and a big enquiry text area. ... drop down menu's and to email it to my client - simple enough ...
    (comp.lang.php)
  • Re: HELP: send binary replies back and forth ???
    ... a client, not a server. ... simple php function to set the timeout), ... Issues in writing php server are: ... >> and communication then goes back and forth between the server and client ...
    (comp.lang.php)
  • HELP: send binary replies back and forth ???
    ... The PHP script receives a request from a client, ... My PHP script loops through all records and sends each of them ONE BY ONE. ... to be able to communicate with apache. ...
    (comp.lang.php)
  • Re: Advantages and disadvantages of PHP?
    ... Sometimes it's PHP, sometimes Java, sometimes something else. ... You'll find, for instance, that while your hosting company offers ASP.NET, their offer in fairly rare, and their price much above equivalent hosting offers in other languages. ... wanted to keep that client. ...
    (comp.lang.php)
  • Re: [PHP] Re: Delete Temporary Internet Files
    ... PHP and IIS / Apache on his local machine. ... > can't read the client files with PHP. ... > Protect your identity with Yahoo! ...
    (php.general)