Sinbad_Sakic Posted October 25, 2008 Share Posted October 25, 2008 Hi to everyone Is there any way to attach multiple values under different ID's, to one menu item? Any ideas to do something similar, if there isn't any? Thanks in advance SS Link to comment https://forums.phpfreaks.com/topic/130059-multiple-values-under-one-menu-item/ Share on other sites More sharing options...
kenrbnsn Posted October 25, 2008 Share Posted October 25, 2008 Please show us an example of what you mean. Your question is hard to understand. Ken Link to comment https://forums.phpfreaks.com/topic/130059-multiple-values-under-one-menu-item/#findComment-674346 Share on other sites More sharing options...
Sinbad_Sakic Posted October 25, 2008 Author Share Posted October 25, 2008 Sorry for that Here's the example: <html> <head> <title>Just a test</title> </head> <body> <form method="post" action="script.php"> Choose site size: <select name="option" id="option"> <option value="First value">First value</option> <option value="Second value">Second Value</option> <option value="Third value">Third Value</option> </select> <input type="submit" /> </form> </body> </html> I want to attach two variables under (for example) First Value, so when it posts to another page, the result will be: -First value -something else I hope now is better Thanks in any case! Link to comment https://forums.phpfreaks.com/topic/130059-multiple-values-under-one-menu-item/#findComment-674360 Share on other sites More sharing options...
kenrbnsn Posted October 25, 2008 Share Posted October 25, 2008 You can put whatever you want in the value clause and then parse it to get the two values: <html> <head> <title>Just a test</title> </head> <body> <form method="post" action="script.php"> Choose site size: <select name="option" id="option"> <option value="First value,another value">First value</option> <option value="Second value">Second Value</option> <option value="Third value">Third Value</option> </select> <input type="submit" /> </form> </body> </html> The in script.php <?php $option = explode(',',$_POST['option']); echo '<pre>' . print_r($option,true) . '</pre>'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/130059-multiple-values-under-one-menu-item/#findComment-674371 Share on other sites More sharing options...
Sinbad_Sakic Posted October 25, 2008 Author Share Posted October 25, 2008 I understand the first part. But the link.php file I use looks like this: Let's say the first value we named first and second - second <?php $first = $_REQUEST['first'] ; $second = $_REQUEST['second'] ; header( "Location: http://www.somedomain.com/$first$second" ); ?> The link which user is going to be redirected will depend on what the user selected. Link to comment https://forums.phpfreaks.com/topic/130059-multiple-values-under-one-menu-item/#findComment-674393 Share on other sites More sharing options...
kenrbnsn Posted October 25, 2008 Share Posted October 25, 2008 Where did that come from? You didn't mention that in the original post. Also please use tags around your code, not <?php $first = $_REQUEST['first'] ; $second = $_REQUEST['second'] ; header( "Location: http://www.somedomain.com/$first$second" ); ?> Ken Link to comment https://forums.phpfreaks.com/topic/130059-multiple-values-under-one-menu-item/#findComment-674400 Share on other sites More sharing options...
Sinbad_Sakic Posted October 25, 2008 Author Share Posted October 25, 2008 Sorry again I barely know php but at the moment I'm forced to do some things with it. That's why I am asking so dull questions. How can I request first and second values from the list menu? EDIT: first and second - I mean when we do the following: <option value="First value,another value">First value</option> Link to comment https://forums.phpfreaks.com/topic/130059-multiple-values-under-one-menu-item/#findComment-674410 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.