fazzfarrell Posted October 16, 2006 Share Posted October 16, 2006 I have create these sessions, exacly the same way on one page<?php session_start();$postConn = $HTTP_POST_VARS['DelCon'];$_SESSION["postConn"] = $postConn; ?> <?php session_start();$curNcy = $HTTP_POST_VARS['curEncy'];$_SESSION["curNcy"] = $curNcy; ?> The $postconn works fine, but the $curNcy does not bring back the desired result?any one help Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/ Share on other sites More sharing options...
dymon Posted October 16, 2006 Share Posted October 16, 2006 $curNcy = $HTTP_POST_VARS['[b]curEncy[/b]'];maybe the var curEncy should be curNcy. Or check what does the $HTTP_POST_VARS['curEncy'] return. Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109534 Share on other sites More sharing options...
fazzfarrell Posted October 16, 2006 Author Share Posted October 16, 2006 If i put it in like this:<?php session_start();$postConn = $HTTP_POST_VARS['DelCon'];$_SESSION["postConn"] = $postConn; ?> <?php session_start();$curNcy = "British Pounds";$_SESSION["curNcy"] = $curNcy; ?> it returns 'British Pounds'But I need it to come from a drop down called 'curEncy' to get the value Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109545 Share on other sites More sharing options...
dymon Posted October 16, 2006 Share Posted October 16, 2006 Show the code of the form from where you send the variable curEncy, with the drop down component. Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109554 Share on other sites More sharing options...
Daniel0 Posted October 16, 2006 Share Posted October 16, 2006 Why not just use: [code]<?phpsession_start();$_SESSION["postConn"] = $_POST['DelCon'];?>[/code] and [code]<?phpsession_start();$_SESSION["curNcy"] = $_POST['curEncy'];?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109556 Share on other sites More sharing options...
fazzfarrell Posted October 16, 2006 Author Share Posted October 16, 2006 the code for the form<form id="frmCurr" name="frmCurr" method="post"><select name="curEncy" id="curEncy" onchange="UpdateQuantity()"><option Selected="True"><?php echo $_SESSION['curEncy']; ?></option><option value="British Pounds">British Pounds</option><option value="American Dollars">American Dollars</option><option value="Euros">Euros</option></select></form> Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109561 Share on other sites More sharing options...
dymon Posted October 16, 2006 Share Posted October 16, 2006 [code] <?print $_POST['curEncy'];?><form id="frmCurr" name="frmCurr" method="post" action=""><select name="curEncy" id="curEncy" onchange="UpdateQuantity()"><option Selected="True"><?php echo $_SESSION['curEncy']; ?></option><option value="British Pounds">British Pounds</option><option value="American Dollars">American Dollars</option><option value="Euros">Euros</option></select><input type="submit" value="Submit"/></form>[/code]For me this code worked. Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109713 Share on other sites More sharing options...
fazzfarrell Posted October 16, 2006 Author Share Posted October 16, 2006 thanksonly problem is they dont want a submit button! Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109722 Share on other sites More sharing options...
dymon Posted October 16, 2006 Share Posted October 16, 2006 ok than, show the JavaScript code, where the form is submited. Because the form and the POST variables are OK.Why your form doesn't have an action="" atributte? Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109723 Share on other sites More sharing options...
fazzfarrell Posted October 16, 2006 Author Share Posted October 16, 2006 i think its this<script Language="VBScript"> Sub UpdateQuantity() frmBasket.submit End Sub Sub DisplayAlert() Alert("Not currently available in electronic format") End Sub</script> Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109741 Share on other sites More sharing options...
fazzfarrell Posted October 17, 2006 Author Share Posted October 17, 2006 I have re-created these sessions<?php session_start();$postConn = $HTTP_POST_VARS['DelCon'];$_SESSION["postConn"] = $postConn; $curNcy = $HTTP_POST_VARS['curEncy'];$_SESSION["curNcy"] = $curNcy; ?>that now get there values from:<form id="frmCurr" name="frmCurr" method="post"> <select name="curEncy" id="curEncy" onChange="document.frmCurr.submit();"> <option Selected="True"><?php echo $_SESSION['curNcy']; ?></option> <option value="British Pounds">British Pounds</option> <option value="American Dollars">American Dollars</option> <option value="Euros">Euros</option> </select> </form> </td> </tr> <tr> <td align="left" valign="middle" class="FormIntroText">Country </td> <td align="left" valign="middle" class="FormIntroText"><form id="frmBasket" name="frmBasket" method="post"> <select name="DelCon" id="DelCon" onChange="document.frmBasket.submit();"> <option Selected="True"><?php echo $_SESSION['postConn']; ?></option> <option value="UK">UK</option> <option value="AGUILLA">AGUILLA</option> <option value="ALBANIA">ALBANIA</option>But the problem is that when you make a seletion from one of the menus it works, change the next option that works but deletes the other sesson? Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109897 Share on other sites More sharing options...
dymon Posted October 17, 2006 Share Posted October 17, 2006 You have to make a check if the variable that comes from the forms are not empty, and if these are not than to create the session vars, try this:[code]<?session_start();$postConn = $HTTP_POST_VARS['DelCon'];if ($postConn != '') $_SESSION["postConn"] = $postConn; $curNcy = $HTTP_POST_VARS['curEncy'];if ($curNcy != '') $_SESSION["curNcy"] = $curNcy;?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109929 Share on other sites More sharing options...
fazzfarrell Posted October 17, 2006 Author Share Posted October 17, 2006 Quality, works a treat thank you! Quote Link to comment https://forums.phpfreaks.com/topic/24098-session-help/#findComment-109933 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.