Jackbeeby Jackbeeby - 1 year ago 74
PHP Question

Send two data packets using a link

I am trying to send two different codes to another page using a link. I am stuck with a problem. The method I have tried only works with one bit of information. I am using php. and the link is generated in a while statement from a database query.

echo "<a href='accept-friend-request.php?unique-key-specificstion=" . $row["unique_key"]. "?key=" . $row["user"]. "'>Save</a>";

is it posible to send two packets of data to the next page using a link. without any sessions or much more code. The method I have tried works with one but when I add two it just posts whatever is in in between the two brackets.

My question might not be 100% clear. please message below on ways to improve the question? Also if there is any questions or comments please post them below. I thank you for your time.

Answer Source

Assuming you wish to send these as part of a query string (i.e. to be retrieved as part of the $_GET superglobal), you need to use ?foo=bar&hello=world. Notice the use of &, not multiple ?:

echo '<a href="accept-friend-request.php?unique-key-specificstion='.$row['unique_key'].'&key='.$row['user'].'">Save</a>';

Now in turn, accept-friend-request.php will receive:

$_GET['unique-key-specificstion']; // Value of $row['unique_key']
$_GET['key'];                      // Value of $row['user']
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download