[Easy] Search Input

Status
Not open for further replies.

JayC

Always Learning
Aug 8, 2013
5,494
1,398
Code:
<form method="post">
                            Username: <input type='text' name='TheUser' maxlength='20'>
                            <?php
                            echo '<td><input type="button" onclick="document.location = \'index.php?_cmd=vip&SearchUser=' . $_POST['TheUser'] . '\';" value="Search"></br>';
                            ?>
                        </form>
I need the input button to use the name they enter but that doesn't seem to work.. Could I get some help with this one xxx thanks!
 

Sysode

Front-End Developer
Dec 11, 2012
1,673
848
Something alone the lines of this?

Oh, sorry for the super lazy response here :p


Edit: Just to say, this is by far no means the "best practice" for this sorta thing. It'll help to get you started though.
 

JayC

Always Learning
Aug 8, 2013
5,494
1,398
Something alone the lines of this?

Oh, sorry for the super lazy response here :p


Edit: Just to say, this is by far no means the "best practice" for this sorta thing. It'll help to get you started though.
if (isset($_GET['SearchUser']))
{

$u = $_GET['SearchUser'];

if (strlen($u) <= 0 || strlen($u) > 20)
{
echo '<center><strong>Usernames less than 1 and greater than 20 characters must be edited in the database manually</strong></center>';
}else
{
echo $u;
}
}
 

Bracks0n

New Member
Mar 7, 2015
3
0
Your code is really confusing, but from what I can see, you're trying to access a $_POST variable before it's been sent. You can't do that.

Also, try using MVC. It will help keep your code neater.

edit: misread your OP, adjusted accordingly
 
Last edited:

LeChris

github.com/habbo-hotel
Sep 30, 2013
2,744
1,326
I personally would use AngularJS

Instructions on the first page show what you're trying to do
 

JayC

Always Learning
Aug 8, 2013
5,494
1,398
Nevermind. Found a new way to do this page! This AngularJS is really cool!
 
c267b9844f55489c328413b2ae874ab2.gif
 
Status
Not open for further replies.

Users who are viewing this thread

☀️  Switch to Light Theme

Latest posts

Top