the5thace Posted July 17, 2013 Share Posted July 17, 2013 (edited) I'm trying to get a query expansion sort of effect that shows suggestions for misspellings and then lets you click them to input them in to your form. So I have passed a variable through a hyperlink but I can't seem to GET it in to the "value" field <form method="POST" action='AllinOneMonstaaa.php'> <label for="query">Query</label><br/> <input name="query" type="text" size="60" maxlength="60" value="<?php echo ($_GET['query']);?>" /><br /><br /> Notice the $_GET. I want it to be auto-filled if a user has selected an option in the previous page from the following php file. if ($s_count > 1) { echo ('<h4>Did you mean?</h4>'); while ($ss_count <=$s_count) { echo '<a href = "AllinOneMonstaaa.php?query='.$suggestion[$ss_count].'">'.$suggestion[$ss_count].'</a><br>'; $ss_count++; } } Edited July 17, 2013 by the5thace Quote Link to comment https://forums.phpfreaks.com/topic/280247-how-to-pass-variable-through-url-and-then-get-that-variable-in-to-a-form/ Share on other sites More sharing options...
AbraCadaver Posted July 17, 2013 Share Posted July 17, 2013 What's not working? Quote Link to comment https://forums.phpfreaks.com/topic/280247-how-to-pass-variable-through-url-and-then-get-that-variable-in-to-a-form/#findComment-1441126 Share on other sites More sharing options...
NomadicJosh Posted July 18, 2013 Share Posted July 18, 2013 Ok, so when the user selects the option, does the url then populate with something like this? AllinOneMonstaaa.php?query=someinfo If so then $_GET['query'] will populate If it is not populating, then can you please explain in a little more detail what you are trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/280247-how-to-pass-variable-through-url-and-then-get-that-variable-in-to-a-form/#findComment-1441182 Share on other sites More sharing options...
a100websolutions Posted July 18, 2013 Share Posted July 18, 2013 Hi the5thace, Your code is absolutely fine. I compiled your code and got some very good results. I think the problem you are having is that the variable $suggestion[$ss_count] is not generating some value during the URL creation. Please check what @parkerJ has mentioned. Does you URL look like AllinOneMonstaaa.php?query=somevaluehere ? Otherwise, please mention the error you are getting Cheers Quote Link to comment https://forums.phpfreaks.com/topic/280247-how-to-pass-variable-through-url-and-then-get-that-variable-in-to-a-form/#findComment-1441259 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.