Jump to content

Cant get variable to set


jjmusicpro

Recommended Posts

I wanted people to go to www.mysite.com/index.php?groupid=1

So when the page is displayed, it should go into my DB and get the valudes from metroareas, and then dispaly some data from the DB.

 

I cant get seem to get it to do that, here is what i got:

 

<?php 
	  if($_SERVER['REQUEST_METHOD'] == "POST"){
	  $groupid = $_GET['groupid']; 
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ 
$site = $row['groupname'] ;
}
		echo $row['groupname'];}
	   ?>

 

Thanks for the help everyone...ima  noob!@

Link to comment
https://forums.phpfreaks.com/topic/59724-cant-get-variable-to-set/
Share on other sites

This is what i have and it seems to work right off the bat when i go to www.mysite.com/index.php?groupid=1

but when i run a search from that page, and it posts back to itself, it wont display it anymore

 

  <?php
	     require_once ('connect.php'); 
  			 require_once ('opendb.php'); 

		 $groupid_sent = $_GET['groupid'];

	   $query = "SELECT * FROM metrogroups WHERE groupid='$groupid_sent'"; 
  $result = @mysql_query ($query); 
  $count = mysql_num_rows($result); //number of results 
  
  while($row = mysql_fetch_array($result, MYSQL_ASSOC)){ 
$groupname = $row['groupname'] ;
echo $groupname;
}
	   ?>

i think i see whats going on, i am not passing the id anymore in the url, how do i pass this again after?

 

when i start out i go to www.mysite.com/index.php?groupid=1

 

then when i run a search function, it sends me back to index.php, so how can i attached or hide that value of groupid?

How do i pass the id on the end of redirect?

 

echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=nf.php\">";

 

like

 

echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=nf.php <?php $groupid_sent = $_GET['groupid']; echo $groupid_sent ?>\">";

 

??? dosnt seem to 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.