close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Multiple check box options - Any advice would be appreciated

Thread began 7/10/2011 6:06 am by Jon Cunningham | Last modified 7/18/2011 1:14 pm by Jason Byrnes | 3601 views | 32 replies |

Jon CunninghamBeta Tester

Multiple check box options - Any advice would be appreciated

Hi Guys, Please could I have some advice on what I am trying do, which is:-.

I have my database which is attached.

May I just add that I am new to sql and databases.

I have created a database which will be used for selling used cars. I have run DA and created the forms that will insert the information, Make Model mileage option etc.

I have created a separate table for option's, such as air con, leather seats, cd auto-changer etc.

Where I have run into difficulty is how to have all the options shown as individual check boxes, so when adding a used car to the database, you have all the different options shown as check boxes and can tick only those options that the car has so when you click insert, all the information for that car is inserted to the database.

I hope that this makes sense.

Kind regards

Jonathon

Attached Files
bjh.txt
vehicle_Insert.zip
Sign in to reply to this post

Jon CunninghamBeta Tester

Ok got a little bit further here.

In my insert page i have added the following code which now outputs the check boxes equal to the option in my database, although we have the tick boxes, i dont have the names associated with them output to my page.

I will continue to work on this and update as i go.

Added code:

<?php do { ?>
<input type="checkbox" name="VehicleOptionName[]" id="VehicleOptionName" value="<?php echo $row_options['VehicleOptionName']; ?>" />
<?php echo $row_options['VehicleOptionName'] ?><br />
<?php } while ($row_rsOptions = mysql_fetch_assoc($rsOptions)); ?>

Sign in to reply to this post

Jason ByrnesWebAssist

you need to add a new table to your database that will be used as a linking table to create a many to many relation ship between the Vehicle and Options Table.

lets name the table vehicle Options:
vehicleOptionsID - primary Key columns
vehicleOptionsVehicleID - relate to the Vehicle.VehicleID column
vehicleOptionsOptionID - relate to the options.OptionsID column


to display all of the available optipons on the insert page, create a recordset:
SELECT * FROM options


then add a checkbox to the page, set the value to use the optionID column, and add the option name binding from the bindings panel next to it to show the name.

now use the data assist manage relational table behavior to along with the insert record behavior to store the selected options in the vehicle options table.

Andrew read posted a good tutorial for the manage relational table behavior here:
showpost.php?p=84393&postcount=17

Sign in to reply to this post

Jon CunninghamBeta Tester

Hi Jason,

I am having real difficulty with this for some reason.

I have followed your instructions along with Andrews tutorial to no avail.

On the insert record page when submitted i get Fatal error: Call to undefined function rel2abs() in C:\xampp\htdocs\bjh001\vehicle_Insert.php on line 207

Could you be good enough to have a look at my code / data base.

I have attached a zip file contain said files.

Kind regards

Jonathon

Attached Files
bjh001.zip
Sign in to reply to this post

Jason ByrnesWebAssist

change line 2:
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>



to:
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once("WA_DataAssist/library.php"); ?>

Sign in to reply to this post

Jon CunninghamBeta Tester

Hi Jason I now get

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\bjh001\vehicle_Insert.php:4) in C:\xampp\htdocs\bjh001\vehicle_Insert.php on line 149

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\bjh001\vehicle_Insert.php:4) in C:\xampp\htdocs\bjh001\vehicle_Insert.php on line 250

regards

Jonathon

Sign in to reply to this post

Jon CunninghamBeta Tester

Hi Jason, i have recreated the page and this time ith runs through to the details page, but it is not inserting the option into the database.

would you have any ideas why?

kind regards

Jonathon

Sign in to reply to this post

Jason ByrnesWebAssist

without seeing the code, my only guess is that the insert record behavior is set to redirect to another page after inserting,

If you send a currant copy of your page I can get a better idea.

Sign in to reply to this post

Jon CunninghamBeta Tester

Hi Jason i think i am just randomly trying everything which after a full days work and 5 hours of this... Any help will be so appreciated.

Im at a stage where the data base does not insert the options and I now get Duplicate entry '35' for key 'PRIMARY'

i have uploaded my insert page.

kind regards

Jonathon

Attached Files
vehicle_Insert.zip
Sign in to reply to this post

Jason ByrnesWebAssist

you have 2 insert behaviors on the page, one to insert to the vehicles table, a sec ond one to insert to the options table.

you should have the second one to insert to options table.

you only need the one insert to insert the vehicle information to the vehicles table, and the Mange Relational table behavior to insert the selected options to the vehicleOptions table

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...