Sigmahokies Posted May 31, 2021 Share Posted May 31, 2021 Hi everyone, I don't know why $_GET didn't get string from URL from another page. can you help? here my code: First page: <?php require("connection.php"); error_reporting(E_ALL); $sql = $GaryDB->prepare("SHOW TABLES"); $list = ""; $list2 = ""; $sql->execute(); while ($row = $sql->fetch()) { $list .= "<a href='$row[0].php?=$row[0]'>".$row[0]."</a><br />"; } ?> <!DOCTYPE HTML> <html lang="en"> <head> <title>Pinky's</title> <link href="paparazzi.png" rel="icon"> <style> * { font-family: Helvetica; text-decoration: none; } body { margin-left: 300px; margin-top: 100px; margin-right: 300px; } </style> </head> <body> <table> <tr><td>Please Select</td><td></td></tr> <tr><td><?php echo $list ?></td></tr> </table> </body> </html> link at left-bottom show localhost:8888/Braclets.php?=Braclet Then why can't $_GET get this strong "Bracelets"? next page: <?php require("connection.php"); $kids = $_GET['Kids']; echo $kids; $sql = $GaryDB->prepare("SELECT * FROM $kids"); echo $sql; ?> Link to comment Share on other sites More sharing options...
dsonesuk Posted May 31, 2021 Share Posted May 31, 2021 Simply because there is no reference to 'kids' in the url, you have '=' and value, but no key of 'kids' Link to comment Share on other sites More sharing options...
Sigmahokies Posted June 1, 2021 Author Share Posted June 1, 2021 There is a reference in url already. I set up the loop in link like this: bracelets.php?=bracelets earrings.php?=earrings kids.php?=kids necklaces.php?=necklaces rings.php?=rings then There is file name already - bracelets.php, earrings.php, kids.php, necklaces.php, and rings.php. So, $_GET should grab reference key from those string in URL, but it didn't. I think $_GET doesn't grab when it come with array. I used implode to convert array to string, but still not work. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now