...

something about hidden form fields perhaps...

c q
08-09-2002, 04:29 PM
<?php
session_start();
?>
<?php
if ( ! isset ( $txtSize ) )
{
session_register( "txtSize" );
$txtSize = "1";
}
?>

<script language=javascript>
function invoke(size){
document.forms[0].value = size;
document.location.reload();
}
</script>

<span class=white1>
<form method="POST" action="<?php print $PHP_SELF?>">
<input type=hidden name=txtSize value="1">
<select NAME="opt" class="grey1" onChange="invoke(this.selectedIndex);" target="_self">
<OPTION>Change Text Size</option>
<OPTION VALUE="small">Small (default)</option>
<OPTION VALUE="medium">Medium</option>
<OPTION VALUE="large">Large</option>
</select>
</form>
</span>
<?php
print $txtSize;
?>

I tought this shud work fine..but it isn't. Well, what I basically want is something that'll allow the user to choose the desired choice so I can store it in the session variable $txtSize and also refresh the current page, all this as soon as the state of the select box changes. Maybe javascript is not the correct way to do it...becoz when I run this script, it simply reloads the page without changing the value of the session variable $txtSize.
Help anyone ?????

c q

c q
08-09-2002, 05:38 PM
Soooorry this is doing the job for me now :D




<?php
if ( isset ( $size ) )
{
$txtSize = $size;
}
?>
<table width=100% cellpadding=0 cellspacing=0>
<tr>
<TD class=gray1 valign=middle bgColor=#696969 align=left>
<span class=white1>
<form method="POST">
<select NAME="size" class="grey1">
<OPTION>Change Text Size</option>
<OPTION VALUE="small">Small (default)</option>
<OPTION VALUE="medium">Medium</option>
<OPTION VALUE="large">Large</option>
</select>

<input type="image" SRC=img/go2.gif WIDTH=16 HEIGHT=16 border=0 align=middle>
</form>
</span>
<?php
print ("<B>$txtSize</B>");
?>


c q



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum