Jump to content

Recommended Posts

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 by the5thace

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?

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

;D 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.