List Info

Thread: How to Post data to another page with hyperlink?




How to Post data to another page with hyperlink?
user name
2006-02-14 08:09:23
You can achieve this with URLencode.
here iam giving you the example for this
<?php
$query_strin
'foo='&nbsp;urlencode( $foo) .&nbsp;'&bar=urlencode ($bar);
echo&nbsp;
'<a&nbsp;href=&quot;mycgi?'&nbsp; htmlentities($query_string) .&nbsp; '"&gt;';
?>

and you can decode with urldecode


<?php
$
explode('&'$QUERY_STRING );
$i 0;
while&nbsp;(
$i count($a )) {
 &nbsp; &nbsp;
$b split( '='$a[$i ]);
 ; &nbsp; ech
'Value&nbsp;for parameter&nbsp;'htmlspecialchars (urldecode($b[ 0])),
 ; &nbsp; &nbsp; &nbsp; &nbsp;
' is&nbsp;'htmlspecialchars (urldecode($b [1])), "<br /&gt;\n";
 &nbsp; &nbsp;
$i++;
}
?>



On 2/14/06, NIÑO PAUL TUQUIB <yahoo.com">niopaulyahoo.com> wrote:
you can actually use session handling in getting data...by using session, u can use the data in all the pages as long as you declare session_start(); at the top of each page...
 
because you want to have it passed using the hyperlink,i'll just give you an example...
 
$username = &_REQUEST['username'];
 
<a href=";profile.php?username=<?=$username?>&quot;><;/a>
 
you can check it by hovering your mouse pointer over the link...
if it contains the data you want to pass, then it's already ok...
 
hope this can help..

I want to know how to post data to another page with hyperlink.
thanks alot...

ghht



Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.




--
Regards,
Ramesh

'My beginning is always today'.
How to Post data to another page with hyperlink?
user name
2006-02-16 20:39:23
try this

<a href="yourpage.php?username=<? echo
$username; ?> > click here for
next page </a>

on the second page just underneath the headers

<?

// if you use the get to send a form
$username=$_get['username'];


// if you use post to send the form

$username=$_post['username'];

echo ('hello : '.$username);

?>


This is a more simple approach to your problem, of passing
varibles
using either the get or post method. no rocket science code.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Professional PHP Developers"
group.
To post to this group, send email to Professional-PHPgooglegroups.com
To unsubscribe from this group, send email to
Professional-PHP-unsubscribegooglegroups.com
For more options, visit this group at http:
//groups.google.com/group/Professional-PHP
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )