mysql - Passing PHP variables onclick -
say have 2 files, fileone.php
, filetwo.php
.
fileone.php
generates list of links, items mysql database, every 1 of these items have unique integer id (1,2,3,4...).
filetwo.php
contains php function uses id create page displaying item clicked in fileone.php
. depending on item click in fileone.php
see different image, text , more in filetwo.php
.
my problem: how @ send id fileone.php
filetwo.php
? use forms $_get variable? purely hypothetical situation , have no code show, need input on how approach this.
yes, pass id via $_get
fileone.php...
<a href="/filetwo.php?id=1">1</a> <a href="/filetwo.php?id=2">2</a> <a href="/filetwo.php?id=3">3</a>
filetwo.php
if(isset($_get['id'])) { //do somethign $_get['id'] }
you should pdo or mysqli receive , sanitize input. not use mysql_ functions deprecated.
Comments
Post a Comment