Jump to content

Archived

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

Canman2005

Two values to one radio button

Recommended Posts

Dear all

I have a simple php page which has about 5 products on it, 3 of the products are the same price and 2 of the products are the same price, I have a radio button next to each product and the value of the radio button is the price of the product, so for example 9.99

I store this in a sql database, what I want to do is to pass another value with whatever radio button they select, this will be stored in the sql database and be able to tell me what the item code is.

For example

I have a radio button which is 9.99 and the item code is 3454334
I then have another radio button which is 9.99 and the item code is 1124565

Is there a way to pass a hidden value with a selected radio button? There would need to be a hidden field for each product, so I could pass the price and also the item code.

I was thinking about maybe an if statement, but as some of the radio button products values are the same price, im not going to be able to connect a if statement to the price of each product, if you see what I mean.

Has anyone been able to do this?

Any help would be great.

Thanks

Ed

Share this post


Link to post
Share on other sites
you could set the radio button value to cost,code and then use..


[code]$radio=explode(',',$_POST['radiobutton']);
$cost=$radio[0];
$code=$radio[1];[/code]


as far as i can think that should work fine :)

Share this post


Link to post
Share on other sites

×

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.