YFinn Posted March 19, 2007 Share Posted March 19, 2007 Hello I am looking for a php code/script, that could do the following. In a text field a visitor can fill in a type of insect, for instance a butterfly, moth or a fly. If someone for instance fills in butterfly, he can also make a choice out of several distances. If the distance: If 1 miles is chosen then /1mlbutterfly.php opens. If 2 miles is chosen then /2mlbutterfly.php opens. If 5 miles is chosen then /5mlbutterfly.php opens. But if someone fills in moth then of course it should be. If 1 miles is chosen then /1mlmoth.php opens. If 2 miles is chosen then /2mlmoth.php opens. If 5 miles is chosen then /5mlmoth.php opens. It opens of course as a _parent page. Hope that someone can help me. Gr Yann Quote Link to comment https://forums.phpfreaks.com/topic/43365-in-a-text-field-a-visitor-can-fill-in-a-name-then-chose-several-distances/ Share on other sites More sharing options...
SammyGunnz Posted March 19, 2007 Share Posted March 19, 2007 Unfortunately YFinn, what you're describing can be done using elementary PHP knowledge and simply handing you the code would not really be helping you, but likely raise more questions down the line. This forum does not really server as a place to exchange scripts, but a place to help people troubleshoot problems or answer questions with existing code. My suggestion to you, would be to learn the basics of PHP and pay special attention to if/else conditional statements, and/or case/switches. Good luck to you. Quote Link to comment https://forums.phpfreaks.com/topic/43365-in-a-text-field-a-visitor-can-fill-in-a-name-then-chose-several-distances/#findComment-210606 Share on other sites More sharing options...
boo_lolly Posted March 19, 2007 Share Posted March 19, 2007 what you're describing doesn't seem like an efficient way of populating results from a form. you should use a database to store and retrieve data, rather than making php pages manually and then calling them up dynamically. Quote Link to comment https://forums.phpfreaks.com/topic/43365-in-a-text-field-a-visitor-can-fill-in-a-name-then-chose-several-distances/#findComment-210612 Share on other sites More sharing options...
Mutley Posted March 19, 2007 Share Posted March 19, 2007 You could do something like: if(isset($_GET['moth'] && $_GET['1mile']) { ...open page... } For each one but it isn't efficient. Quote Link to comment https://forums.phpfreaks.com/topic/43365-in-a-text-field-a-visitor-can-fill-in-a-name-then-chose-several-distances/#findComment-210621 Share on other sites More sharing options...
per1os Posted March 19, 2007 Share Posted March 19, 2007 <?php if (isset($_GET['uname']) && isset($_GET['miles'])) { $page = $_GET['miles'] . "ml" . $_GET['uname'] ".php"; } ?> That should get you the desired result. Quote Link to comment https://forums.phpfreaks.com/topic/43365-in-a-text-field-a-visitor-can-fill-in-a-name-then-chose-several-distances/#findComment-210642 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.