Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undefined Index

Status
Not open for further replies.

clanm

Programmer
Dec 26, 2005
237
US
I've got a page a user sees if they're a new user. They enter an email and password.

If the "Check New Username" behavior allows the entry to continue, the new user will enter more information about themselves.

I'm trying to use the Email and password for the first two text fields in the next form via Bindings / Form Variable, but get the following for both these fields:

Undefined index: Email in <b>C:\htdocs\NewSubInfo.php

The HTML is:

value="<?php echo $_POST['Email']; ?>"

This should be pretty simple, but I'm not too sure what I'm doing wrong.

Thanks!
 
can you post the form too?

things to check:
are you certain you are using the post method and not the get method in your form
have you spelt (caps sensitive) the email field "Email" or some other combination. variables are case sensitive (and variable elements) so $_POST['email'] is different to $_POST['Email']

to see what the post array holds try
Code:
echo "<pre>";
print_r($_POST);
echo "</pre>";
 
Hi jpadie!

I've checked to make sure the spelling is correct.

For the button click on the first page, here's the code that's called to decide which page to go to next:

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO main (Email, Password) VALUES (%s, %s)",
GetSQLValueString($_POST['Email'], "text"),
GetSQLValueString($_POST['password'], "text"));

mysql_select_db($database_connLE, $connLE);
$Result1 = mysql_query($insertSQL, $connLE) or die(mysql_error());

$insertGoTo = "NewSubInfo.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

*******************

What's odd is if I take the <?php echo $editFormAction; ?> action out of the form and put in NewSubInfo.php (keep the method to Post), the two fields on the next page are in fact populated w/o errors.
 
Form on second page:
<table width="80%" border="1">
<tr >
<td width="100%">Email:<font color="red">*</font></td>
<td width="100%"><input name = "email" type="text" value="<?php echo $_POST['Email']; ?>" size="100"></td>
</tr>
<tr>
<td>Password:<font color="red">*</font></td>
<td><input name="password" type="text" value="<?php echo $_POST['password']; ?>" size="100" maxlength="100" /></td>


 
i have not got to grips with your page flow. where do you get the "$_POST['Email'] from if not from this form. if you do get it from this form you need to change the form element name to "Email" (it was previously "email". see below:

Code:
 <table width="80%" border="1">
    <tr  >
      <td width="100%">Email:<font color="red">*</font></td>
      <td width="100%"><input name = "Email" type="text" value="<?php echo $_POST['Email']; ?>" size="100"></td>
    </tr>
    <tr>
      <td>Password:<font color="red">*</font></td>
      <td><input name="password" type="text" value="<?php echo $_POST['password']; ?>" size="100" maxlength="100" /></td>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top