Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to pass a variable to another page

index.php

$typesql = $_GET['type']

fetch_pages.php

$results = $mysqli->prepare("SELECT name, type FROM artists WHERE type = ?);

$results->bind_param("s", $typesql);
$results->execute();
$results->bind_result($name, $type);

I use the above to get the artist type in index.php, I want to pass it to use it in fetch.php and bind it to my sql query.

like image 661
Kareem Kamal Avatar asked Nov 25 '25 07:11

Kareem Kamal


1 Answers

You can put the $_GET value to a session and you can use that session variable to access the data on another page

example
page 1

session_start();
$_SESSION['type']=$_GET['type'];

page 2

session_start();
$type = $_SESSION['type'];
like image 200
Nijeesh Joshy Avatar answered Nov 26 '25 20:11

Nijeesh Joshy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!