Jump to content

Help with $_POST & $_GET!


u214

Recommended Posts

Hello guys. I'm trying to improve my control panel system. I have this page where you input a player's name and when you hit "Search" it will display that user's information.

 

Ok. This is the code:

<form action="ShowStats.php" method="post">
<li><font color="#FF9933"><b>User's Name:</b></font> <input type="text" name="User" /></li>
<p> </p>
<p> </p>
<input type="submit" value="Search" /></form>

That's when you input the player's name and the Search button.

 

Once you hit that button, I want the Address bar to display something like this:

"www.test.com/ShowStats.php?User=SEARCHED_USER"

 

Here's the $_POST ( and "fetch" user's info ) function inside "ShowStats.php"

					include("database.php");
				if(!$con)
				{
					die('Could not connect: ' . mysql_error());
				}

				$user = $_POST["User"];
				$escuser = mysql_real_escape_string($user);

				$result = mysql_query("SELECT * FROM playerinfo WHERE user = '$escuser'");

				$username_exist = mysql_num_rows($result);
				if($username_exist == 0)
				{
					echo('<b><font color="#C41F1F">That username does not exist</b></font>');
					echo('<p><center><font face="Arial" color="#000080" size="2"><b><a href="http://yu-ki-ko.com/fsns/Stats.php">Go back</a></b></center></font></p>');
					die;
				}
				$row = mysql_fetch_row($result);

 

All I want is that when a user searches for the player, the address bar will be displayed like:

"www.test.com/ShowStats.php?User=SEARCHED_USER"

 

Thanks! If any more info is needed, let me know.

Link to comment
https://forums.phpfreaks.com/topic/235554-help-with-_post-_get/
Share on other sites

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.