 |
| Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 3rd, 2007, 08:18 PM
|
|
Registered User
|
|
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Creating a php order form
I am creating an order form using php and html. I have 3 items to choose from with check boxes. How do I pass the value of the checkbox to the receipt form so I can show a total for the just the items ordered before I add shipping and taxes?
Beckie
|
|

February 5th, 2007, 08:21 AM
|
|
Registered User
|
|
Join Date: Feb 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Well, it's pretty simple. How advanced are you with PHP? My explanation will depend on your level of expertise.
|
|

February 5th, 2007, 12:13 PM
|
|
Registered User
|
|
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by falkflyer
Well, it's pretty simple. How advanced are you with PHP? My explanation will depend on your level of expertise.
|
I am new to it. I am taking a class at the college and so go ahead and
explain it and if I can't make sense of it I'll let you know.
Beckie
|
|

February 12th, 2007, 08:17 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Beckie,
let us suppose three checkbox item 1, item 2, item 3
then i hope below code will be usefull for you..
<form method="post" action="process.php">
<input type="checkbox" name="item1" value="items[]"/>
<input type="checkbox" name="item1" value="items[]"/>
<input type="checkbox" name="item1" value="items[]"/>
<input type="submit" value="SUBMIT"/>
</form>
process.php
if(is_array($_POST[items]))
{
$orders="Item orders: ".implode(", ",$_POST[items]);
}
i hope this is the requirement u asking for. please let me know if this is the reqirement u asking for.
|
|

February 12th, 2007, 12:43 PM
|
|
Registered User
|
|
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you this will work. I put the array in the name not the value and the I had didn't come close. Thanks again. Now I am off to figure out how to work with MySQL and SQL in php. :) Beckie
Beckie
|
|

February 13th, 2007, 07:24 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi beckie i am sorry beckie not to include checkbox name so this will help u
<form method="post" action="process.php">
<input type="checkbox" name="item1" value="items[]"/> Item 1
<input type="checkbox" name="item2" value="items[]"/> Item 2
<input type="checkbox" name="item3" value="items[]"/> Item 3
<input type="submit" value="SUBMIT"/>
</form>
|
|

February 13th, 2007, 11:39 AM
|
|
Registered User
|
|
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
That's ok I already figured that. Just figured you would like to know I am selling bridges. This was an assignment for a class that I couldn't get any answers from the teacher. Everything else worked on my form but this one part. He just taught php to himself. Thanks Again. Beckie
By the way I just looked at my last post and the I was suppose to say if. Now I have to figure out MySOL & SQL to create a database that will allow me to input at least 5 people to keep checking back I might need your help again.
Beckie
|
|

February 14th, 2007, 06:43 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
come to think of it i am not that good in php .. i am also learner...
sorry i made mistake here that is value and name parameters....
<form method="post" action="process.php">
<input type="checkbox" value="item1" name="items[]"/>
<input type="checkbox" value="item1" name="items[]"/>
<input type="checkbox" value="item1" name="items[]"/>
<input type="submit" value="SUBMIT"/>
</form>
|
|

February 14th, 2007, 06:51 AM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i didn't get what u mean by
Now I have to figure out MySOL & SQL to create a database that will allow me to input at least 5 people to keep checking back I might need your help again.
i think u have to put user registration page with user name and email. So one table user table with three field id (primary key), name and email. Then u have to use session to remember which user is logged in and for the responding user id u have to insert their respective items which they buy in another table item table fields id, user_id, itemsname,price.
i hope this is what u luking for...
|
|

February 14th, 2007, 10:17 AM
|
|
Registered User
|
|
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Not sure yet will yet, but I am sure I will have more questions.
Beckie
|
|
 |