URL Parameters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Skywalker
Forum Contributor
Posts: 117
Joined: Thu Aug 29, 2002 3:33 am
Location: The Netherlands

URL Parameters

Post by Skywalker »

How do I have to set URL parameters, tryed everything.

What I have now is this. The URL Parameters must be Dynamic.

<?php $imtem_id= $row_Recordset1['ProduktID']; //Haalt ProduktID op uit recordset en stopt hem in $item_id
$imtem_name= $row_Recordset1['ProduktNaam']; //Haalt ProduktNaam op uit recordset en stopt hem in $item_name


<?php "<a href='http://localhost/test/bestellijst.php?' ... em_name</a>";?>
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You aren't echoing out the link you're creating and you seem to be mispelling some variable names, you've also not assigned a variable name to the $item_id value in the query string:

Code: Select all

&lt;?php 
//Haalt ProduktID op uit recordset en stopt hem in $item_id
$item_id= $row_Recordset1&#1111;'ProduktID'];
//Haalt ProduktNaam op uit recordset en stopt hem in $item_name
$item_name= $row_Recordset1&#1111;'ProduktNaam'];

echo '&lt;a href="http://localhost/test/bestellijst.php?item_id='.$item_id.'"&gt;'.$item_name.'&lt;/a&gt;';
?&gt;
Hope it helps.

Mac
Last edited by twigletmac on Fri Aug 30, 2002 2:55 am, edited 1 time in total.
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Re: URL Parameters

Post by mikeq »

Skywalker wrote:How do I have to set URL parameters, tryed everything.

What I have now is this. The URL Parameters must be Dynamic.

<?php $imtem_id= $row_Recordset1['ProduktID']; //Haalt ProduktID op uit recordset en stopt hem in $item_id
$imtem_name= $row_Recordset1['ProduktNaam']; //Haalt ProduktNaam op uit recordset en stopt hem in $item_name


<?php "<a href='http://localhost/test/bestellijst.php?' ... em_name</a>";?>
Have a look at your single quotes

either this

<?php "<a href="http://localhost/test/bestellijst.php?= ... em_name</a>";?>

or

<?php "<a href='http://localhost/test/bestellijst.php?= ... em_name</a>";?>

but what are you setting to $item_id

<?php "<a href="http://localhost/test/bestellijst.php?[b]whatvariable[/b]=$item_id">$item_name</a>";?>

Then 'whatvariable' will be available within bestellijst.php as a variable and will contain the value that was in $item_id, it is passed as GET

$_GET['whatvariable'] or $whatvariable - dependent on your version of PHP and the status of the global variables setting in the php.ini
User avatar
Skywalker
Forum Contributor
Posts: 117
Joined: Thu Aug 29, 2002 3:33 am
Location: The Netherlands

Post by Skywalker »

Arg I now know what was wrong in the next script, wher this vars wher send to, I used $_Post to get the vars, but is had to be $_GET :P

But thenk you guys enyway. :D No I have a new problem with my Cookie :S
Post Reply