Jump to content

undefined variables


shwetapandit

Recommended Posts

i got undefined var errors on line no 26,27,28 for variables fname,lname,phone.how they can be undefined they are getting retrived by mysql.how to remove these errors.

 

<?php
session_start();
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="regis"; // Database name
$tbl_name="regis"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

if(isset($_SESSION['email']))
$email=$_SESSION['email'];
{
$query="SELECT fname,lname,phone,email FROM regis WHERE email='$email'";
$result=mysql_query($query);
$num=mysql_fetch_array($result);}
?>
<table width="600" cellpadding="10" cellspacing="0" border="2">
<tr align="center" valign="top">

<td align="center" colspan="1" rowspan="1">
<form action="update.php" method="POST">
<input type="hidden" name="email" value="<?php echo "$email"?>">
<input type="text" name="fname" value="<?php echo "$fname"?>">
<input type="text" name="lname" value="<?php echo "$lname"?>">
<input type="text" name="phone" value="<?php echo "$phone"?>">
<input type="submit" value="submit">
</form></td></tr></table>


 

Link to comment
https://forums.phpfreaks.com/topic/283958-undefined-variables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.