Re: refresh PHP page via onclick event
| From: | afan at afan dot net | Date: | Sat, 15 Apr 2006 12:30:49 +0000 |
| Subject: | Re: refresh PHP page via onclick event | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-234034@lists.php.net to get a copy of this message | ||
Or, use form and images as button and you will not get variables at the
end of the link:
<form method=post action=<?= $_SERVER['PHP_SELF'] ?>>
<input type=images src=engFlag.jpg name=lang value=en>
<input type=images src=fraFlag.jpg name=lang value=fr>
</form>
and on the top of the page (php file) before you grab info from database
and language info (maybe i the header file):
<?php
if(isset($_POST['lang']))
{
$_SESSION['lang'] = mysql_real_escape_string($_POST['lang']);
}
?>
-afan
> On 15 Apr 2006, at 12:51, Alain Roger wrote:
>
>> but i do not want to add some variable at the end of link...
>> when user click on the flag, it should first store language into a
>> $_SESSION
>> variable and after redirect/refresh page.
>
> Not possible. Web pages don't work like that.
>
> You need the flags to link somewhere, and only then can it store the
> details in the session. So either each flag links to its own PHP
> script (pointless), or you follow the advice of Chris and handle it
> that way. However you look at it though, you've got to pass a
> language somehow. Either via the query string, or by calling a unique
> script that handles that language only.
>
> Cheers,
>
> Rich
> --
> http://www.corephp.co.uk
> Zend Certified Engineer
> PHP Development Services
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>