Jump to content

php radio buttons and implode is this even possible ?


megz90

Recommended Posts

*i can use php mysql and javascript if i need to*

 

hey all.

I would like to know if what I would like to do is possible I’m sure it is but I probably need some pointers as my method is probably wrong...

 

I have a number of tables in a MYSQL database

 

The main tables are

Horse – lots of information about the horse

Service  - list of services that can be provided serviceID, cost, description etc...

Booking  - booking number (auto inc number), date (varchar10), horseID, service

 

On the make booking php page i have managed to get a form setup,

 

At the mo the form does this :

 

-List the available horses and put them in a drop down box

(Lists only the horses belonging to the user that is logged in)

- look at the services table and list all the services as radio buttons with a value of serviced or no

- make a input field for the date

 

 

What i would like to do is list the services as i am doing and then let the user select  the yes option for as many as they want. For all the ones that are selected (not ‘no’)

 

I need to find some way of getting the service id (s)  putting some character between then and storing it in the booking table

Ie if user selects the first 3 services and service 5

It could look like  ...  1#2#3#5

 

That way i can then later use explode to just get the services again when i put it in a report or want i want to look at what services are booked.

 

Do u think im going about this process in the right way and what would u suggest i look at to try and help me to code the above

 

 

Snippets  from my code

 

while($row = mysql_fetch_array($resultser, MYSQL_ASSOC))
{ 
echo "{$row['dbservicename']} <br/>";
echo "<input type='radio' name='{$row['dbserviceId']}' value='{$row['dbserviceId']}'>
              yes <br><input type='radio' name='{$row['dbserviceId']}' value='no' checked='checked'>
              no<br>

This outputs :

servicename1 O yes O no

servicename2 O yes O no

servicename3 O yes O no

etc until all the rows in the table service is shown

 

 

cheers for any help or pointers...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.