Welcome! Log In Create A New Profile

Advanced

Radio / Checkboxes for MySQL

Posted by 42893275-P 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Radio / Checkboxes for MySQL
April 29, 2013 03:59PM
Everything working well... but selection page.
Retrived everything to show on the selections page...
Tryna use radio buttons to select fixtures and checkboxes to select players... anyone has an idea on how to go about doing that?
Sir please help. I can create, view, edit & delete records... login page works well to. Its just the selection page confused smiley
Re: Radio / Checkboxes for MySQL
April 30, 2013 07:28AM
I did similar thing...
but best advice would be to go look at last years Javascript book.
You also you might want to google, Posting checkboxes into an array.

I do however want to warn you that I am stuck on same path...
Validation has caused me some headaches....
not sure how to count how many users are selected and then restrict this (i.e. before post)

so currently my team can take 0, 3 or 100 members in the team....
forcing me to do some ugly things db side to cope. (deleting team before re-entering team... whether it is an update or fresh create) confused smiley
avatar
Mac
Re: Radio / Checkboxes for MySQL
April 30, 2013 08:02AM
This part is specifically not covered in the tut letter as I want you to figure it out.

Google for guidance e,g, http://www.html-form-guide.com/php-form/php-form-checkbox.html http://www.phpfreaks.com/tutorial/working-with-checkboxes-and-a-database
Re: Radio / Checkboxes for MySQL
April 30, 2013 10:02AM
@42609852 last night i managed to get the radio buttons working... selects one "Fixture" from the available, also the checkboxes "BUT" there's a problem, the checkbox selections will only return the "last player" say i select 5... only the 5th player gets pulled and displayed. confused smiley now i used foreach just to check if the right ids are assigned to the player's checkboxes... works well "when i echo the foreach loop the correct ids are displayed e.g. a 5 player selection will display the ids 1, 6, 7, 10, 12 "I used PHP only no javascripts"
@Mac I'll check the links hope to figure it out soon thanks!
Re: Radio / Checkboxes for MySQL
April 30, 2013 10:43AM
You can send the checkboxes via an array by making them the same name (and an array) ...
Language: HTML
name=';Selected[]';

this then send them as an array...
and you can just save it in an array

I think the way you where sending it only sends the last value...

ahhh go read the html-form-guide... shows how to do it and is very clear
Re: Radio / Checkboxes for MySQL
April 30, 2013 11:34AM
Just read both posts "interesting" smileys with beer . I was using
Language: PHP
name=';Selected[]';
i think my problem was, not using the IN clause and a bit of validation.
phpfreaks explains the subject very-well!!!
now just have to transform from confused smiley to thumbs up smiley THANKS!!!
Re: Radio / Checkboxes for MySQL
May 01, 2013 06:01PM
I managed to get the radio buttons and checkboxes to retrieve data from both tables "fixtures and players" and preview/check if that's want the team manger wants. now I need clarity on...
• The third table is for team selections. Give a name of your choice. It must have the following fields:
• selection_id (primary key, auto increment)
• fixture_id
• fields as required by the team (e.g fullback (TEXT), wing (TEXT) etc.)
where should the selections be inserted?

should I create fields for the Fixture, player's name, surname and position in the selections table? please help. Almost done just need clarity.
Re: Radio / Checkboxes for MySQL
May 01, 2013 07:30PM
I think this table is to join the other two tables,
and it does not matter how you join them... but think this is what Mac wants to test....

we should figure out how to do this.
there is multiple way's of doing this, find what works best for your site.

(might want to go check normalisation in your SQL book from last year (but dont think this is needed though, but does make it easier)
avatar
Mac
Re: Radio / Checkboxes for MySQL
May 02, 2013 07:33AM
Yes. This has been discussed in another thread.
Sorry, only registered users may post in this forum.

Click here to login