Jump to content

Place input data inside sent URL


Carlton

Recommended Posts

This has been bothering me for a while, how do I do this?

 

echo
("
    <form  method = 'get' action = 'member.php?action=Search&option=faction&name=NAME'>
                                        Faction's Name: <input type='text' name='member' /><br /><br />
                                        <input type='submit' value='Search' />
                                    </form>
");

 

name='member' is supposed to be sent with here: member.php?action=Search&option=faction&name=NAME. Obviously replacing NAME with the input.

Link to comment
https://forums.phpfreaks.com/topic/222445-place-input-data-inside-sent-url/
Share on other sites

Here, and gl :)

echo
("
    <form  method = 'get' action = 'member.php?action=Search&option=faction&name=' . $_GET['member'] . '>
                                        Faction's Name: <input type='text' name='member' /><br /><br />
                                        <input type='submit' value='Search' />
                                    </form>
");

Here, and gl :)

echo
("
    <form  method = 'get' action = 'member.php?action=Search&option=faction&name=' . $_GET['member'] . '>
                                        Faction's Name: <input type='text' name='member' /><br /><br />
                                        <input type='submit' value='Search' />
                                    </form>
");

 

I tried that before I posted this. No luck.

where does the value for NAME come from? where does the value come from that you want to put into the echo statement?

 

// Where do we get the value for $somevalue, in the echo below?

echo "<form  method = 'get' action = 'member.php?action=Search&option=faction&name=$somevalue'>
                                    Faction's Name: <input type='text' name='member' /><br /><br />
                                        <input type='submit' value='Search' />
                                    </form>";

 

where does the value for NAME come from? where does the value come from that you want to put into the echo statement?

 

// Where do we get the value for $somevalue, in the echo below?

echo "<form  method = 'get' action = 'member.php?action=Search&option=faction&name=$somevalue'>
                                    Faction's Name: <input type='text' name='member' /><br /><br />
                                        <input type='submit' value='Search' />
                                    </form>";

 

There's no value, this: <input type='text' name='member' /> is supposed to be in the member.php?action=Search&option=faction&name=THEINPUTSENT

 

Sorry if i'm misunderstanding you

there is no input when you first open the script, so the value will be name= (nothing). When you post the form there will be 2 different names: one POST'ed and the other one GET'ed. if you want to put the POST'ed value into that string, you'll need to use something like this:

 

$posted_name = urlencode(stripslashes($_POST['name']));  // Remove stripslashes if magic quotes is not on.
echo "<form  method = 'get' action = 'member.php?action=Search&option=faction&name=$posted_name'>
                                    Faction's Name: <input type='text' name='member' /><br /><br />
                                        <input type='submit' value='Search' />
                                    </form>";

 

i don't understand the purpose for this, but that should work.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.