Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
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
 
Old February 3rd, 2007, 08:18 PM
Registered User
 
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old February 5th, 2007, 08:21 AM
Registered User
 
Join Date: Feb 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to falkflyer Send a message via MSN to falkflyer
Default

Well, it's pretty simple. How advanced are you with PHP? My explanation will depend on your level of expertise.

 
Old February 5th, 2007, 12:13 PM
Registered User
 
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old February 12th, 2007, 08:17 AM
Authorized User
 
Join Date: Feb 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.
 
Old February 12th, 2007, 12:43 PM
Registered User
 
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old February 13th, 2007, 07:24 AM
Authorized User
 
Join Date: Feb 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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>

 
Old February 13th, 2007, 11:39 AM
Registered User
 
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old February 14th, 2007, 06:43 AM
Authorized User
 
Join Date: Feb 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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>




 
Old February 14th, 2007, 06:51 AM
Authorized User
 
Join Date: Feb 2007
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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...
 
Old February 14th, 2007, 10:17 AM
Registered User
 
Join Date: Feb 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Not sure yet will yet, but I am sure I will have more questions.

Beckie





Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting/Creating element in order whelanm XSLT 3 August 14th, 2008 12:54 PM
Creating a login page in PHP bhavna General .NET 0 February 16th, 2007 07:32 AM
Form Startup Order NeilS21 Beginning VB 6 2 February 26th, 2004 05:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.