Hi all,
Hope someone can point out the obvious. I've a log in script, if you dont enter a username or pw, you get a red asterix show by the field and a pop up.
If you enter an email but not the pw, it says Undefined variable: email_error .
This is the code:
// Validate the email address.
if (!empty($_POST['email'])) {
$e = escape_data($_POST['email']);
} else {
echo '<script type="text/javascript">alert("You forgot to enter your email address!");</script>';
#echo '<p class="error">You forgot to enter your email address!</p>';
$e = FALSE;
$email_error = '<span class="required"><img src="images/star.gif" /></span>';
}
// Validate the password.
if (!empty($_POST['pass'])) {
$p = escape_data($_POST['pass']);
} else {
$p = FALSE;
echo '<script type="text/javascript">alert("You forgot to enter your password!");</script>';
$pw_error = '<span class="required"><img src="images/star.gif" /></span>';
#echo '<p class="error">You forgot to enter your password!</p>';
}
My form looks like:
<form action="login.php" method="post">
<table border="0" width="310">
<tr>
<td><img src="images/email_address.gif" /></td>
<td><div class="myBoxLh"></div><input type="text" name="email" style="width:150px;" maxlength="90" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /><div class="myBoxRh"></div><?php if (isset($_POST['submitted'])) { echo $email_error; }?></td>
</tr>
<tr>
<td><img src="images/password.gif" /></td>
<td><div class="myBoxLh"></div><input type="password" name="pass" style="width:150px;" maxlength="20" /><div class="myBoxRh"></div><?php if (isset($_POST['submitted'])) { echo $pw_error; }?></td>
</tr>
<tr>
<td colspan="2"><div align="left"><?php if (isset($_POST['submitted'])) { echo $error_message; }?></div><div align="right"><input type="image" src="images/submit.jpg" name="submit" value="Login" class="submit_small" /></div>
<input type="hidden" name="submitted" value="TRUE" /></td>
</tr>
</table>
</form>
How can I stop this error as I thought I'd coded the correct way?
Thanks in advance
Custom CMS
This is a big custom CMS script I'd like to develop and would like some help atleast figuring out where the best place to start would be.Website PagesBackstage 2 provides website pages for the
Amend code to allow multiple attachments
Hi I have a php page that allows the user to browse to a file (image) then sumbit, the confirmation page then has the following code which uploads the said file to the hosting server, but also appends
How to validate from 2 possible answers
Hi I hope somebody can help me with what will probably be really simple, I'm pulling my hair trying to get my head round it.I've got a contact form and I would like to add to it a couple of simple
Get keys and values from an array
Hellow,I have an array $Data with keys and values. With a foreach I can display all the values:foreach($Data as $var){ echo $var;}but I also want to display al the keys... how can i do that?
Format String help
I have a textbox where a person enters an application number. the application number is 10 characters in length:ex: 000012345A0256775434My clients only want to enter in the numbers without the
Undefined Index Notice In Internet Explorer Only
I am getting the following notice: QuoteNotice: Undefined index: jrox in /home/ycsn/public_html/mem/includes/html/templates/template_member_home_page.php on line 20It only appears within Internet
How to assign JS screen.width to ASP.Net variable
I've got this ASP.net routine that gets the cookie value of the screen width, but now I need to change it so that it gets the width using Javascript, in case the users don't have cookies enabled.
To add a field on the screen XK02.
Hi All,
Help with echo()
I'm having some problems with this code:Code: echo ' <A
DateObject and Nulls
Hi all,I have an array mapped to a value object. One of the items in the array is a PHP DateObject, and I need to format this field appropriately.When looping through the array, I pass this field to a