PhpMysql $_post $_get

Hello Experts...I really need your help Im having problem with my code
( How can I echo the $row["id"];)
to other php?...

I have a query on the second page

$query = "SELECT * FROM tbl_route WHERE fk_travel_id = '".$_GET["id"]."'";

Now what I want to happen is go get the row ID value of my table and add it into my query

                               while($row = mysqli_fetch_array($result))  
                               <tr class='clickable-row' data-href='route.php?route=<?php echo $row["id"];?>' id="<?php echo $row["id"];?>">
                                    <td><input type="checkbox" name="travel_id[]" class="delete_id" value="<?php echo $row["id"]; ?>" /></td>
                              <td><?php echo $row["destination"]; ?></td>  
                              <td><?php echo $row["description"]; ?></td>  
                              <td><?php echo $row["dater"]; ?></td>  
                              <td><input type="button" name="edit" value="Edit" id="<?php echo $row["id"]; ?>" class="btn btn-info btn-xs edit_data" /></td>  
                                    <td><input type="button" name="view" value="view" id="<?php echo $row["id"]; ?>" class="btn btn-info btn-xs view_data" /></td>  

How to solve this guys?...or any other to execute in same way...

Thank You in Advance Experts
Yaku KakashiAsked:
Who is Participating?
Chris StanyonConnect With a Mentor Commented:
If you look at your PHP code:

<tr class='clickable-row' data-href='route.php?route=<?php echo $row["id"];?>

Your route.php now has a query string with a parameter name of route, so in order to use that in route.php, you would need $_GET['route']

$query = "SELECT * FROM tbl_route WHERE fk_travel_id = '".$_GET["route"]."'";
Leonidas DosasCommented:
If i understand correctly you must use $_SESSION global variable. Check this tutorial link
mohan singhConnect With a Mentor Web developerCommented:
Hi @Yaku Kakashi
Always put your code in code section Ok

//this is your query write
$query = "SELECT * FROM tbl_route WHERE fk_travel_id = '".$_GET["id"]."'"; 

//change your query like this
$id =$_GET['id'];
$query = "SELECT * FROM tbl_route WHERE fk_travel_id = '$id' "; 

if pass id from One page to Another page then you have to request that id 
//please put your code inside of code box

Open in new window

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Yaku KakashiAuthor Commented:
Yes I already corrected my code Experts...thank you... Well Done..
mohan singhWeb developerCommented:
Your problem is solved or not
if it solved so please close the question

Thank you

Mohan SIngh
Julian HansenCommented:
It is not clear what you are trying to do.

What do you mean when you say
How can I echo the $row["id"]
Where does $row['id'] come from
How / why do you need it in a second PHP page?
Is the second PHP page part of the same request or are you describing a situation where the id must persist over multiple requests from the client?
Yaku KakashiAuthor Commented:
Thank you guys... You are really awesome
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.