Jump to content

[SOLVED] Trouble with passing variable via URL


Recommended Posts

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 link

while ($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=10

However in my receiving page I have put the following echo command but nothing is returned.  Help?

echo $_GET['query_number'];
[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 it

do me another favour

[code]

print_r($_GET);

[/code]
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.
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.