jpratt Posted June 27, 2006 Share Posted June 27, 2006 [img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /] I am unable to get values from two login fields into session variables. The following code is not putting the values from my text fields into my session variables:<? if(isset($_POST['SID']) && isset($_POST['EID'])){ $_SESSION['SID']=$_POST['SID'];$_SESSION['EID']=$_POST['EID'];header("Location: owner/main.php");}?>.....<form name="login" method="post" action="login.php"><input name="SID" type="text" class="inputbox" size="50" maxlength="50"><input name="EID" type="text" class="inputbox" id="EID" size="50" maxlength="60"><input name="Submit" type="submit" class="btn" value="Login"></form>Any ideas? Please help!!! Link to comment https://forums.phpfreaks.com/topic/13039-post-and-session-varaibles/ Share on other sites More sharing options...
Orio Posted June 27, 2006 Share Posted June 27, 2006 Add session_start() at the top [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]Orio. Link to comment https://forums.phpfreaks.com/topic/13039-post-and-session-varaibles/#findComment-50157 Share on other sites More sharing options...
jpratt Posted June 27, 2006 Author Share Posted June 27, 2006 Do I need anything at the beginning of the next page to reference these variables? Link to comment https://forums.phpfreaks.com/topic/13039-post-and-session-varaibles/#findComment-50161 Share on other sites More sharing options...
wildteen88 Posted June 27, 2006 Share Posted June 27, 2006 When ever you use sessions you will need to have session_start as the first line for each page that uses sessions. Link to comment https://forums.phpfreaks.com/topic/13039-post-and-session-varaibles/#findComment-50163 Share on other sites More sharing options...
a1ias Posted June 27, 2006 Share Posted June 27, 2006 [!--quoteo(post=388578:date=Jun 27 2006, 06:44 PM:name=justinphp)--][div class=\'quotetop\']QUOTE(justinphp @ Jun 27 2006, 06:44 PM) [snapback]388578[/snapback][/div][div class=\'quotemain\'][!--quotec--]Do I need anything at the beginning of the next page to reference these variables?[/quote]just session_start();personally I would create friendly variables on the new page like:$eid = $_SESSION['EID'];$sid = $_SESSION['SID'];(usually at the beginning) Link to comment https://forums.phpfreaks.com/topic/13039-post-and-session-varaibles/#findComment-50164 Share on other sites More sharing options...
jpratt Posted June 27, 2006 Author Share Posted June 27, 2006 Thanks, works great. I inherited this site and have been trying to get it going with a new hosting company, I have no idea on how they got it going with their old hosting. Again, thanks a bunch!! Link to comment https://forums.phpfreaks.com/topic/13039-post-and-session-varaibles/#findComment-50167 Share on other sites More sharing options...
wildteen88 Posted June 27, 2006 Share Posted June 27, 2006 You saying that this is a previous script from someone and that they didn't have session_start at the top of their pages? If thats the case then they most probably had setting called [b]session.auto_start[/i] enabled.This setting starts the session on every page request without having to use session_start(). Link to comment https://forums.phpfreaks.com/topic/13039-post-and-session-varaibles/#findComment-50176 Share on other sites More sharing options...
jpratt Posted June 27, 2006 Author Share Posted June 27, 2006 using the auto start would be a bad idea if part of your is not part of a session, right? Part of the site takes cc#'s and phyical address and email addresses and the part of the site that is not part of the session is not secure. What is your opinion? Link to comment https://forums.phpfreaks.com/topic/13039-post-and-session-varaibles/#findComment-50177 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.