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
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;
}
	   ?>

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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