Jump to content


Photo

sessions/forms


  • Please log in to reply
3 replies to this topic

#1 speedy33417

speedy33417
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 12 September 2006 - 11:28 PM

First time posting here. New to php. ;D

I'm trying to use sessions for an html form to process user ID and password.
index.php receives two variables that need to be global variables which will be carried over to loggedin.php and verified either invalid user id and/or password or access to that page.

My problem is the first half: index.php

This is what I have so far:

<html> 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> 
<link rel="stylesheet" type="text/css" href="inc/theme.css"> 
</head> 

<body leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0" marginheight="0" marginwidth="0"> 

  <form name="logForm" action="loggedin.php"> 
    <div align="center"> 
      <table border="0" width="610" cellpadding="0" cellspacing="0"> 
        <tr> 
          <td width="105" valign="top"><span class="text1">&nbsp;user ID</span></td> 
          <td width="105" valign="top"><span class="text1">&nbsp;password</span></td> 
          <td width="400"></td> 
        </tr> 
        <tr> 
          <td width="105" valign="top"><input name="userId" class="form3"></td> 
          <td width="105" valign="top"><input name="passWord" class="form3"></td> 
          <td width="400" valign="bottom"><a href="javascript:if(document.logForm.onsubmit())document.logForm.submit()" class="text1">Log in</a></td> 
        </tr> 
      </table> 
    </div> 
  </form> 
          
</body> 

</html> 

I need help inserting the session for those variables so after submitting, they can be called with a session_start on loggedin.php.

#2 gijew

gijew
  • Members
  • PipPipPip
  • Advanced Member
  • 240 posts
  • LocationCalifornia

Posted 12 September 2006 - 11:32 PM

All I see is some HTML.  Are you trying to verify the user on the same page or are you passing it to another page?  I'm kind of confused as to where you're going with this.  From what I get you're trying to have verify a user but I didn't see any code that indicates anything but displaying a form = /
I'm considered good looking in some countries

#3 speedy33417

speedy33417
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts

Posted 13 September 2006 - 12:02 AM

I was going to get it verified on the next page, but now that you ask me is it possible to do it on the same page?

But getting back to the way I wanted to do it. I hear about all these super globals at what not. I wanted to make sure that my first page is all done before I worry about the second one.
Do I need to start a session on index.php or it's good as is?

#4 PigsHidePies

PigsHidePies
  • Members
  • PipPip
  • Member
  • 27 posts

Posted 13 September 2006 - 05:31 AM

Yea, its possible to do it on the same page, just have to put the form and the variables above the actual php code else you'll get an error since the user hasn't given any info yet. I recommend you start a session at the top of all your pages since you are going to be using sessions. That way, if someone is already logged in, you can have the page display somtehing else besides letting him signup again.
ex:
<?php session_start(); ?>
<html>
etc
</html>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users