Jump to content

[SOLVED] how to create link in php ?? pass value from .php to .php


UnrEALMe

Recommended Posts

hi everyone.. can php create a link ?? i need to pass a value from a .php to another .php.... if using html is like that...

 

<p><a href="main.php">Main</a> </p>

 

how to use php to do so ?? or html can do it ?? i need to pass a value from a form to the other form.. please advice

 

You have it stored in $username..

So you use:

//file one to send data
<?php
$username = "Andy";
echo '<a href=myfile.php?username='.$username.'>Click Here</a>';
?>

//File to retrieve data
<?php
$username = $_GET['username'];
echo $username;
?>
[code]

This is a simple way of doing it. There are many other more secure methods of doing this but by what i can tell your only new to php so this would be  a basic way of doing so.

Hope it helps.
Andy

[/code]

Using Headers half way down a file only causes warnings.

You could try the following:

 

<?php
$username = "Andy";
echo 'Redirecting you now.. Please wait.';
echo '<META HTTP-EQUIV="refresh" CONTENT="5; URL=members.php?username=" . $username . ">";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.