carphone Posted March 8, 2009 Share Posted March 8, 2009 Hi All, I am very new to PHP so please be gentle with me I am building a form which collects some data using method GET. I have a list box which holds data like this: item label-------------Value 1100-------------------2 1200-------------------3 I need to use both the "item label" and "value" fields in the php script i am writing. Currently only the "value" is passed. Can anyone help me with ideas on how i can do this? I hope this makes sense, as i mentioned i am very much a newbie to this. Many Thanks Dan Quote Link to comment https://forums.phpfreaks.com/topic/148510-help-with-forms-get-passing-variable-value-and-label/ Share on other sites More sharing options...
Michdd Posted March 8, 2009 Share Posted March 8, 2009 There should be no need to send the label value as well because the label in correspondence to the value is always a constant. So if you have value 3, you know that the label was 1200. Quote Link to comment https://forums.phpfreaks.com/topic/148510-help-with-forms-get-passing-variable-value-and-label/#findComment-779862 Share on other sites More sharing options...
carphone Posted March 8, 2009 Author Share Posted March 8, 2009 Hi thanks for the quick response, my data will have duplicate values, eg item label-------------Value 1100-------------------2 1200-------------------5 1220-------------------5 3310-------------------2 the labels are nokia model numbers and the value represents the type of chip inside that model. I guess i can put the handset model as the value and just write some code to assign the number to each handset. Was just hopeful there would be a quicker way. Another question if you dont mind. When my submit button is pressed my form resets the list box values back to default. Is there a way to keep the list box values the same as was selected by the user when the submit button is pressed? Thanks for your help, very much appreciated. Thanks Dan Quote Link to comment https://forums.phpfreaks.com/topic/148510-help-with-forms-get-passing-variable-value-and-label/#findComment-779875 Share on other sites More sharing options...
Maq Posted March 9, 2009 Share Posted March 9, 2009 Is there a way to keep the list box values the same as was selected by the user when the submit button is pressed? Yes. Can we see the processing code? Quote Link to comment https://forums.phpfreaks.com/topic/148510-help-with-forms-get-passing-variable-value-and-label/#findComment-780058 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.