Forum Moderators: coopster

Message Too Old, No Replies

Passing a value onclick

         

dave1236

2:56 am on May 9, 2008 (gmt 0)

10+ Year Member



I have a few images I am using on my site, designated for specific groups.

When a user clicks on an image, I want to pass a designated value to subsequent pages, as part of the session. What is the best way to accomplish this?

I currently use this code for an actual login by individual...can I simply change the input type to 'hidden' and give it a value, and change the submit to 'click'?

<form action="Login2006menu.php?do=login" method="POST">
<p align="left"><font size="2" face="Arial"><u><b>MEMBER LOGIN:</b></u><br>
Username<br>
<input type="text" name="fusername"
size="20" maxsize="20"><br><font size="2" face="Arial">Password</font><br>
<input type="password" name="fpassword"
size="20" maxsize="20">
<input type="submit" name="log"
value="Enter">
</form>

Pico_Train

6:42 am on May 9, 2008 (gmt 0)

10+ Year Member



you can do this with images putting a value in the $_GET

<a href="example.php?u_id=<?php echo $value;?>"><img src="image.gif"></a>

But otherwise, the rest of your post is confusing...

Otherwise for SESSIONS if login is successful you could:

if (login == true)
{

$_SESSION['user_id'] = $userAuthenticate['user_id'];

}

[edited by: Pico_Train at 6:43 am (utc) on May 9, 2008]

StoutFiles

11:59 am on May 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Both a hidden post or a get variable would work fine. Depends on your preference.