Hey guys, thanks for the replies.
I think, like you said, it will be easiest for me to post my code.
<?php session_start(); ?>
<?php include_once 'inc/db.inc.php'; ?>
<?php
if (isset($_POST['submitted'])):
$email = (empty($_POST['email'])) ? '' : $_POST['email'];
$password = (empty($_POST['password'])) ? '' : md5($_POST['password']);
$sql="SELECT * FROM users
WHERE email='$email' and password='$password'";
$result=mysql_query($sql);
$num=mysql_numrows($result);
$i=0;
$found=0;
while ($i < $num)
{
{
$_SESSION['email'] = $_POST['email'];
$id = session_id(); //let's grab the session ID for those who don't have cookies
$url = "Location: channelzone-panel.php?sid=" . $id;
header($url);
$found=1;
$i=$num;
}
$i++;
}
if ($found==0)
include_once 'header.php';
include_once 'headerend.php';
{
echo "<br />";
echo "<p>Email or Password incorrect. Please try again.</p>";
}
?>
<?php else: ?>
<?php include_once 'header.php'; ?>
<?php include_once 'headerend.php'; ?>
<title>Channel Zone</title>
<h2 align="center">CHANNEL ZONE</h2>
<p>If you feel you should have access to the 'Channel Zone' then please fill out
the form listed below to request a login. Once you have requested a login, we
will contact you with the details once your application has been approved.</p>
<div class="loginchan">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p>Please enter your username and password to login.</p>
<p>If you are not already a member, click <u><a href="registration.php">here</a></u> to sign up.</p>
<p>Email: <br />
<input name="email" type="text" id="email" size="25" maxlength="50" />
</p>
<p>Password: <br />
<input name="password" type="password" id="password" size="25" maxlength="20" />
</p>
<p><input type="submit" name="submit" value="Submit" /></p>
<input type="hidden" name="submitted" value="TRUE" />
<p>Forgotten your password? Click <u><a href="newpass.php">here</a></u> to reset it.</p>
<?php endif; ?>
</div>
</form>
<?php
if (isset($_POST['submitted2'])):
$email2 = (empty($_POST['email2'])) ? '' : $_POST['email2'];
$i2=0;
$found2=0;
?>
<div class="requestchan">
<?php
echo "<br />";
echo "<br />";
echo "<br />";
echo "<p>Thank you for requesting a channel login.</p>";
echo "</div>";
?>
</div>
<?php else: ?>
<div class="requestchan">
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p>Please enter the following details to request a channel zone login.</p>
<p>Channel Name: <br />
<input name="channame2" type="text" id="channame2" size="52" maxlength="50" />
</p>
<p>Email: <br />
<input name="email2" type="text" id="email2" size="52" maxlength="50" />
</p>
<p align="right"><input type="submit" name="submit" value="Submit" /></p>
<input type="hidden" name="submitted2" value="TRUE" />
<?php endif; ?>
</div>
</form>
<?php include_once 'footer.php'; ?>
The "register" form which I mentioned is basically just a means of sending an email request to ask for a login to the site, it isn't finished yet though.
As you can see from the code on each form I'm using the post method:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
and I think some confusion might be being caused by this and the php "isset" code.
if (isset($_POST['submitted'])):
Both forms using the same methods so I think this is where the confusion might be happening, but I presumed that if you used different variable names then it should be fine?
Thanks a lot.