Jump to content

Archived

This topic is now archived and is closed to further replies.

jpratt

Post And Session Varaibles

Recommended Posts

[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!!!

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Do I need anything at the beginning of the next page to reference these variables?

Share this post


Link to post
Share on other sites
When ever you use sessions you will need to have session_start as the first line for each page that uses sessions.

Share this post


Link to post
Share on other sites
[!--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)

Share this post


Link to post
Share on other sites
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!!

Share this post


Link to post
Share on other sites
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().

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.