How to remove E_ALL errors
Posted: Sat Oct 27, 2007 8:49 am
This is the code i wrote. It works fine without E_ALL error reporting. I read in a php tutorial that it is a good practice to turn error_reporting to E_ALL. If it is turned on, i get Undefined variable: for all the variables. How to debug this? I tried to used isset, it's not showing error for process, member_name, member_passord. Now i am getting
Notice: Undefined variable: member_name in C:\wamp\www\message\index.php on line 36
Notice: Undefined variable: member_password in C:\wamp\www\message\index.php on line 40
should i have to use isset() for all variables? Is there any other method to solve this?
Notice: Undefined variable: member_name in C:\wamp\www\message\index.php on line 36
Notice: Undefined variable: member_password in C:\wamp\www\message\index.php on line 40
should i have to use isset() for all variables? Is there any other method to solve this?
Code: Select all
<?php
error_reporting(E_ALL);
require_once('config/includes.php');
if(isset($_POST['process'])) $process=$_POST['process'];
if(isset($_POST['member_name'])) $member_name=$_POST['member_name'];
if(isset($_POST['member_password'])) $member_password=$_POST['member_password'];
if(isset($process))
{
switch($process)
{
case 'submit':
submit();
case 'show_form':
show_form();
default: show_form();
}
}
else
{
show_form();
}
function show_form()
{
$login_table=
"<form method='post' action='index.php?process=submit'>
<table border='1' align='center'>
<tr>
<td>Username</td>
<td><input type='text' name='member_name' value='$member_name'></td>
</tr>
<tr>
<td>Password</td>
<td><input type='text' name='member_password' value='$member_password'></td>
</tr>
<tr>
<td colspan='2' align='center'><input type='submit' name='submit' value='submit'></td>
</tr>
</table>
</form>";
$data=array('{content}' => $login_table);
ReadTemplate('templates/main_temp.html', $data);
}