tags:

views:

64

answers:

4

Hi,

I would like to set values on an url like this:

<a href='http://$data_url/viewyournote.php?chapter='$name_of_chapter'&amp;note='$id_note'&amp;user='$username'&gt;

Then be able to grab then from the recieving page.

Right now all im getting is this when clicked:

http://localhost/readnotes/viewyournote.php?chapter=
+1  A: 

Use Query string

$val = "yourvalue" ;

$url "http://localhost/readnotes/viewyournote.php?chapter=$val";

Now $val is passed to specified url .

There you could get it by using $_GET['chapter'] , It will give you "yourvalue"

pavun_cool
+1  A: 

I don't how you embed your link in your code, but if it is outside of <?php ?> tags, then you have to do:

<a href="http://&lt;?php echo $data_url ?>/viewyournote.php?chapter=<?php echo $name_of_chapter ?>&note=<?php echo $id_note ?>&user=<?php echo $username?>" >

if it is inside these tags, you can also do:

echo  "<a href='http://$data_url/viewyournote.php?chapter=$name_of_chapter&amp;note=$id_note&amp;user=$username?' >";

You can get these values on the recieveing page with $_GET['variable_name_here'], e.g. $_GET['chapter'].

Felix Kling
+1  A: 
<a href='http://$data_url/viewyournote.php?chapter=&lt;?php echo $name_of_chapter; ?>&note=<?php echo $id_note; ?>&user=<?php echo $username; ?>>
harpax
+1  A: 

Replace your line with

<?php
echo "<a href='http://$data_url/viewyournote.php?chapter='$name_of_chapter'&amp;note='$id_note' user='$username'>";
 ?>

On the receiving end use

<?php
$name_of_chapter = $_GET['chapter'];
...
?>
Hannes de Jager