Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    c q
    c q is offline
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mumbai, India
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    something about hidden form fields perhaps...

    <?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
    Last edited by c q; 08-09-2002 at 04:32 PM.

  • #2
    c q
    c q is offline
    Regular Coder
    Join Date
    Jun 2002
    Location
    Mumbai, India
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Soooorry this is doing the job for me now




    <?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
    It's a new world. It's a new day.
    www.nehasaxena.com : : www.kohimaorphanage.org


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •