Re: Undefined offset: 1 chapter 5 form.php
Guys,
When i try to run throo the step 2 it gives me an error message:
Undefined offset: 1 in C:\wamp\www\php_sandbox\form4.php on line 61
: Movie: Action
This is my form.php:
<?php
function debugDisplay()
{
?>
<pre>
$_POST
<?php
print_r($_POST);
?>
$_GET
<?php
print_r($_GET);
?>
</pre>
<?php
}
if (!isset($_GET['step']))
{
require('startform.php');
}
else
{
switch($_GET['step'])
{
case "1":
$type = explode(":", $_POST['type']);
if($_POST['Submit'] == "Add")
{
require($_POST['Submit'] .$type[0] . '.php');
}
else
{
if($_POST['type'] == "Movie:Movie" && $_POST['Movietype'] = "")
{
header("Location:form4.php");
}
?>
<h1>Search Results</h1>
<p>You are looking for a "<?php echo $type[1]; ?>" named
"<?php echo $_POST['Name'];?>"</p>
<?php
}
if($_POST['Debug'] == "on")
{
debugDisplay();
}
break;
case "2":
$type = explode(":", $_POST['type']);
?>
<?php
switch($type[0])
{
case "Movie":
?>
<h1> New <?php echo $type[1]; ?> : <?php echo $_POST['Name'];?></h1>
<p> Released in <?php echo $_POST['MovieYear'];?></p>
<p><?php echo nl2br(stripslashes($_POST['Desc']));?></p>
<?php
break;
default:
?>
<h2>Quick Bio</h2>
<p><?php echo nl2br(stripslashes($_POST['Bio']));?></p>
<?php
break;
}
break;
default:
require("startform.php");
break;
}
}
?>
Please help me out on this.
Thanks,
Harish.C
|