Canman2005 Posted March 14, 2006 Share Posted March 14, 2006 Dear allI 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.99I 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 exampleI have a radio button which is 9.99 and the item code is 3454334I then have another radio button which is 9.99 and the item code is 1124565Is 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.ThanksEd Quote Link to comment https://forums.phpfreaks.com/topic/4915-two-values-to-one-radio-button/ Share on other sites More sharing options...
shocker-z Posted March 14, 2006 Share Posted March 14, 2006 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 :) Quote Link to comment https://forums.phpfreaks.com/topic/4915-two-values-to-one-radio-button/#findComment-17324 Share on other sites More sharing options...
Canman2005 Posted March 14, 2006 Author Share Posted March 14, 2006 Fantastic, thanks Quote Link to comment https://forums.phpfreaks.com/topic/4915-two-values-to-one-radio-button/#findComment-17328 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.