Page 1 of 1

I need urgent help for my order form

Posted: Sat Jul 02, 2011 9:20 pm
by boituron
Hi i'm new here and with php and I want to ask for some help regarding my order form.

Here is my existing code.
Image

Basically what it does in the form is filled the item(text field) with the number of orders (1,2,3 etc.)
What I wanted to do is to have the "filled up" orders sent to me and not everything. So for example
the customer only filled the text field for food1, then its the only order that will be sent in my email.

Any help or suggestions will be highly appreciated. I'm also open if you know a better code than mine. Thanks!

Re: I need urgent help for my order form

Posted: Sun Jul 03, 2011 12:13 pm
by califdon
Does your form have these text fields in it? I don't see them where you are assigning the $_POST values to variables. If you have fields like "text1" and "text2" in your form, the only way you will know what the user filled in is to look for $_POST values like $_POST['text1'], etc.

Re: I need urgent help for my order form

Posted: Mon Jul 04, 2011 10:56 am
by Noodleyman
you just need to do some extra checking on the fields.

Something like this:

Code: Select all

IF (!empty($_POST['name'])){
    echo "This has some data, so will do something with it";
}ELSE{
    echo "this field had no data so exclude it";
}

Re: I need urgent help for my order form

Posted: Tue Jul 05, 2011 1:59 pm
by rascle
And in your case, rather than echoing something, you can just put the mail code there :)

Re: I need urgent help for my order form

Posted: Tue Jul 05, 2011 5:25 pm
by califdon
rascle wrote:And in your case, rather than echoing something, you can just put the mail code there :)
I believe he was echoing an acknowledgment to the browser screen.