When error_reporting(E_ALL); is turned on I'm having the following example of notice
Notice: Undefined variable: name in /home/user/public_html/directory/subdirectory/test.php on line 111
Notice: Undefined variable: identity in /home/user/public_html/directory/subdirectory/test.php on line 116
in every form field if I want to save user inputted data in text fields using session after the form is submitted by the users.
Example of my current code is as following:
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['identity'], "text")
<?php $_SESSION['form'] = $_POST; ?>
<form action="<?php echo $editFormAction; ?>" method="post" name="userform" id="userform">
<input name="name" type="text" id="name" value="<php$_SESSION['form']['name'] = '';?><php $_SESSION['form']['name']; ?>" size="25" />
<input name="identity" type="text" id="identity" value="<php$_SESSION['form']['identity'] = '';?><php $_SESSION['form']['identity']; ?>" size="25" />
and so on.............
I gout suggestion about eliminating undefined index using
<php$_SESSION['form']['name'] = '';?>
as value of text field like,
<input name="name" type="text" id="name" value="<php$_SESSION['form']['name'] = '';?><php $_SESSION['form']['name']; ?>" size="25" />
The above code resolves undefined index notice but produces undefined variable notice.
The form works well when error reporting is off.
Any idea, how to define the undefined variable in this case?