Jump to content

undefined variables


shwetapandit
Go to solution Solved by 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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.