Jump to content

[SOLVED] $_GET not working....


dadamssg

Recommended Posts

im developing a forum...and i have a page that displays a certain topic and im trying to create the reply page and script.

 

i have a template page that grabs the id number out of the url and displays the topic info based on that...works fine

 

now im tryin to make a reply button that will send them to the reply form with that same id number in the url...and ill use that id number to put in the db.

 

heres what i have for the topic page..just the top..grabbing the number, making sure its a number, then making sure its in the db, if not send to homepage...works perfect in the initial page

session_start();
$postid = $_GET["id"];

if (! ctype_digit($postid)) {
        header("Location: http://www.mysite.com");
    }

 include("caneck.inc");
   
   $postid = $_GET["id"];

$cxn = mysqli_connect($host,$user,$passwd,$dbname)
          or die ("Couldn't connect");
	  
$quer = "SELECT * FROM test WHERE eventid = $postid";

$rsult = mysqli_query($cxn,$quer)
          or die ("Couldn't execute");
		  				  
	$found = mysqli_num_rows($rsult); //check if postid exist, if not send to homepage
	if ($found > 0)
	 {}
	 else
	{header("Location: http://www.mysite.com");}

 

and heres how i create the reply button with the id in the url

echo "<form action='reply_form.php?rid={$postid}' method='POST'>
<input type='submit' name='do' value='Reply'>
		</form>";

 

it works...sends me to reply_form with the same number

 

but when i try to copy and paste the above checking the $postid into reply_form.php it doesn't work...i can type in any number or letters in the url, click enter and it will pull up a blank page. anybody have any suggestions?

 

 

Link to comment
https://forums.phpfreaks.com/topic/151472-solved-_get-not-working/
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.