PHP Line Error
Posted: Sun Mar 16, 2014 11:18 am
Hi All,
This is my first post and I am new to PHP . I have created an html file along with PHP . When I am executing it with values put in there it is giving errors for 2 of my lines . Please help me understand why is it giving me error when my code looks ok .
HTML
$type=$_REQUEST['type'];
$address=$_REQUEST['address'];
This is my first post and I am new to PHP . I have created an html file along with PHP . When I am executing it with values put in there it is giving errors for 2 of my lines . Please help me understand why is it giving me error when my code looks ok .
HTML
PHP<html>
<body>
<form method="GET" action="handle_form.php">
<h1> Add a New Contact to the Address Book
</h1>
Full Name: <input type="text" value="Dr John Smith" name="fname"/><br/>
Phone Number: <input type="text" value="+63 (0) 123 456 789" name="phnum"/><br/>
Type of Phone: <input type="radio" name="type"/> Mobile <input type="radio" name="type" />
Landline <input type="radio" checked="yes" name="type" /> Unknown <br/>
Full Postal Address:<br/>
<textarea cols=40 rows=8 name="address" >Add comments here</textarea address ><br/>
Relationship(s):<br/>
<input type="checkbox" name="relationship">Friend<br/>
<input type="checkbox" name="relationship">Family<br/>
<input type="checkbox" name="relationship" checked="checked">Business<br/>
<input type="submit" name="submit" value="Submit Info">
<input type="reset" name="clear" value="Clear Form">
</body>
</html>
ERROR<?php
$fname=$_REQUEST['fname'];
$phnum=$_REQUEST['phnum'];
$type=$_REQUEST['type'];
$address=$_REQUEST['address'];
$relationship=$_REQUEST['relationship'];
echo "$fname $phnum $address $relationship";
?>
Looks like error in following linesPHP Notice: Undefined index: type in C:\inetpub\wwwroot\handle_form.php on line 5
PHP Notice: Undefined index: address in C:\inetpub\wwwroot\handle_form.php on line 6
$type=$_REQUEST['type'];
$address=$_REQUEST['address'];