I'm trying to find a way to pass a value to a page much like a form does when you submit user data, but without using a form. I have a script that returns data from a database and displays it out in this nice table. I need to be able to click on items in one of the columns (username) as a link and have it pass a value (the users name) to a new page so i can work with that value (basically sending it to a stored procedure in a MSSQL DB again).
The part I’m having a problem with is how to pass the username as a value to another .php page without using a form or starting a session (if possible). Is there an alternate way to submit a form by clicking a link or some way to pass a value from a function to a new page?
Any suggestions would be appreciated. Thanks!
noob qustion about passing values to other pages..
Moderator: General Moderators
In my first page I use the link like this
Then in the edit_process page I look the the variable in the link URL like this...
Code: Select all
<?php
<A HREF="edit_process.php?id=$id">
?>Code: Select all
<?php
$query = "SELECT * FROM tablename WHERE id = $_GET[id]";
?>Just do something like this.. notice the position of the PHP tags unlike the previous example which I don't think would work!
..to echo() the entire bit from PHP code you would do this..
..does that make sense?
Code: Select all
<a href="target_page.php?colour=<?php echo($colour); ?>">Change Colour</a>..to echo() the entire bit from PHP code you would do this..
Code: Select all
<?php
echo("<a href="target_page.php?colour=".$colour."">Change Colour</a>");
?>