Forum Moderators: coopster
I have setup an sql table containing project data (job no, description, date and auto-number id) which displays in rows on my main page. Next to each project is a link which a user can click to submit their details to show interest in that particular project. When they click this link they are taken to another page with a contact form, but I need to automatically show the job no of the project they selected in this form. I have successfully got the job no for the 1st record in the table into the field but need to make it dynamic.
How do I get the correct job no according to the link they click?
Thanks.
newpage.php?var=1&row=2
then on the newpage.php, add code that would check for the value of the query string using $_GET; e.g. $_GET['var'] and $_GET['row'] from here you can add your script on what you want to do with the data passed on the link.
Here is what your hyperlink would look like
mysite/cat_page.php/``cat=1&col=1
At the beginning of the following page's code:
$vars = get_url_vars(); //my function
parse_str($vars); //php function
....................
then you can access $cat and $col in the code.
here is my declared function
function get_url_vars()
{
$temp_url = $_SERVER['PHP_SELF'];
$rip = explode('``',$temp_url);
return $rip[1];
}
It may not be the best way to do it, and certainly not the only way...but when I was there, this is how I solved the problem. (I also put in a check for control characters in the variables on each page...but I couldn't get any through anyway when I was testing)