Jump to content

Recommended Posts

Hello experts,
   I am using a query string code. I want to "get" variable of one page to another page.

   Query1.php:

<?php
$konek = mysql_connect("localhost","root","") or die("Cannot connect to server");
mysql_select_db("test",$konek) or die("Cannot connect to the database");
$query = mysql_query("select * from persons where id='1'");
$row = mysql_fetch_array($query);
$q= $row['details'];
?>

<a href='query_1.php?id=" . $q . "'>aa</a>

query_1.php:

<?php
//$ab=1;

//if(isset($_GET['id'])) 
$ab= $_GET['id'];
echo $ab;
?>
 
The above code does not run and give error:
 
Notice: Undefined index: id
 
I am not geting what i am missing.
So, can some help me out wid my mistake....

 

Link to comment
https://forums.phpfreaks.com/topic/285580-query-string-error-undefined-index-id/
Share on other sites

Well..., the code works perfectly fine in Query1.php page. But if i would nt have pasted my link
i.e echo "<a href='edit_last_follow.php?id=" . $a . "'>aa</a>"; 

inspite only :

echo "<a href='edit_last_follow.php?id=" . $a . "'></a>"; 

so how will i get the $a on my next page which is query_1.php page:


<?php

if(isset($_GET['id']))
$ab= $_GET['id'];
echo $ab;
?>

I want to echo $a of Query1.php page on query_1.php page.
I tried with the code above. I am stuck what i am missing.

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.