taking the value from the URL....

Thread Solved

Join Date: May 2007
Posts: 66
Reputation: dudegio is an unknown quantity at this point 
Solved Threads: 0
dudegio dudegio is offline Offline
Junior Poster in Training

taking the value from the URL....

 
0
  #1
Aug 30th, 2007
Hello guys!

As usual i need anybody help. pleeeeaaaaase.....
My problem is to take value from the URL. Not the entire value but only part of it like the example below.

http://localhost.localdomain/YPS/let...-full.php?id=5

This is the link where the value id is passed from the previous page. Value for id varies on the link being clicked(i.e. taken from the database). No sessions and forms were used. All i need is to take the value 5 from the link so that this will be my reference on my query on that page. Any idea please share. Thanks a lot to everyone.

Here's my code on the previous page.

<?php
dbconnect();

$count=0;
$queryresult= mysql_query("SELECT * FROM tbl_topic") or die("SELECT Error: ".mysql_error());
while ($rec=mysql_fetch_array($queryresult, MYSQL_ASSOC)){
$color = ( $count % 2 == 0 ) ? "#eeeeee" : "white";
print '<tr bgcolor="'.$color.'"><td><font>'."$rec[topic] :".'</font >'.truncate($rec["title"],65).'<br/><a style="color:#0066CC; font-size: 10px;" href="lets-talk-main-conversation-full.php?id='.$rec["id"].'">'."view full transcript".'</a>'." [ $rec[date_posted] ]".'</td></tr>'."\n";
$count++;
}
?>
Last edited by dudegio; Aug 30th, 2007 at 11:26 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 189
Reputation: martin5211 is an unknown quantity at this point 
Solved Threads: 14
martin5211 martin5211 is offline Offline
Junior Poster

Re: taking the value from the URL....

 
0
  #2
Aug 31st, 2007
Use WHERE clause to filter occurrences in Mysql results and $_GET or $_POST variables to get url parameters (according to form method). For example, add including the quotes:

  1. WHERE id = '". $_GET['id'] . "'
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 569
Reputation: ryan_vietnow is an unknown quantity at this point 
Solved Threads: 71
ryan_vietnow's Avatar
ryan_vietnow ryan_vietnow is offline Offline
Posting Pro

Re: taking the value from the URL....

 
0
  #3
Aug 31st, 2007
use $_GET or $_REQUEST
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 66
Reputation: dudegio is an unknown quantity at this point 
Solved Threads: 0
dudegio dudegio is offline Offline
Junior Poster in Training

Re: taking the value from the URL....

 
0
  #4
Aug 31st, 2007
Thanks a lot. Its working.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC