doucie Posted December 30, 2006 Share Posted December 30, 2006 OK, I have the following code in my 1st page and I am trying to pass the variable query_number through to the page query_details.php via a linkwhile ($row=mysql_fetch_array($result)){$query_number=$row['query_number'];$query_type=$row['query_type'];$query_status=$row['query_status'];$client=$row['client'];$client_ref=$row['client_ref'];$debt_ref=$row['debt_ref'];$query_date=$row['query_date'];$user=$row['user'];echo "<tr><td><a href='query_details.php?=query_number=$query_number'</td>" . $query_number;The URL looks OK - http://localhost/Query%20System/query_details.php?=query_number=10However in my receiving page I have put the following echo command but nothing is returned. Help?echo $_GET['query_number']; Quote Link to comment https://forums.phpfreaks.com/topic/32272-solved-trouble-with-passing-variable-via-url/ Share on other sites More sharing options...
paul2463 Posted December 30, 2006 Share Posted December 30, 2006 Hi Doucie the URL should look like this[code]http://localhost/Query%20System/query_details.php?query_number=10 // without the first = sign after the ?[/code]Paul Quote Link to comment https://forums.phpfreaks.com/topic/32272-solved-trouble-with-passing-variable-via-url/#findComment-149813 Share on other sites More sharing options...
doucie Posted December 30, 2006 Author Share Posted December 30, 2006 OK it now reads http://localhost/Query%20System/query_details.php?query_number=2There is still no variable displayed in the receiving page Quote Link to comment https://forums.phpfreaks.com/topic/32272-solved-trouble-with-passing-variable-via-url/#findComment-149817 Share on other sites More sharing options...
paul2463 Posted December 30, 2006 Share Posted December 30, 2006 do me a favour and store the $_GET variable as another variable and try and echo that out[code]<?php$myvar = $_GET['query_number'];echo $myvar;?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/32272-solved-trouble-with-passing-variable-via-url/#findComment-149818 Share on other sites More sharing options...
doucie Posted December 30, 2006 Author Share Posted December 30, 2006 OK did that.<?php$number=$_GET['$query_number'];echo $number;?>Still nothing, no errors either, just a blank page. Quote Link to comment https://forums.phpfreaks.com/topic/32272-solved-trouble-with-passing-variable-via-url/#findComment-149820 Share on other sites More sharing options...
paul2463 Posted December 30, 2006 Share Posted December 30, 2006 [quote]OK did that.<?php$number=$_GET['$query_number'];echo $number;?>Still nothing, no errors either, just a blank page.[/quote]if you did this you will not get anything the variable name in the $_GET square barckets should n ot have a $ sign on it because the URL $_GET variable does not have a $ sign on itdo me another favour[code]print_r($_GET);[/code] Quote Link to comment https://forums.phpfreaks.com/topic/32272-solved-trouble-with-passing-variable-via-url/#findComment-149822 Share on other sites More sharing options...
wildteen88 Posted December 30, 2006 Share Posted December 30, 2006 this code:[code]echo "<tr><td><a href='query_details.php?=query_number=$query_number'</td>" . $query_number;[/code]Is not valid. You have not finish creating the link. This should do:[code]echo '<tr><td><a href="query_details.php?query_number=' . $query_number . '">$query_number</a></td>";[/code]Also please note that file/folder names should not have spaces in them. You should use either a hyphen (-) or an underscore (_) in replacement of the space. Quote Link to comment https://forums.phpfreaks.com/topic/32272-solved-trouble-with-passing-variable-via-url/#findComment-149823 Share on other sites More sharing options...
xyn Posted December 30, 2006 Share Posted December 30, 2006 The problem is the _I found the only way around it is doing this...query.number=replacing the _ with a . Quote Link to comment https://forums.phpfreaks.com/topic/32272-solved-trouble-with-passing-variable-via-url/#findComment-149824 Share on other sites More sharing options...
doucie Posted December 30, 2006 Author Share Posted December 30, 2006 Works! Simple when you know how. Cheers guys. Quote Link to comment https://forums.phpfreaks.com/topic/32272-solved-trouble-with-passing-variable-via-url/#findComment-149825 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.