hello
i am a student ane new to php i have a code here i want to pass the data from one page to another but i m not able to do so plz check both the code and please help

<html>
<head>
<title>update_tanenet</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css" />


<link rel="stylesheet" type="text/css" href="style.css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="css/coin-slider.css" />
<script type="text/javascript" src="js/cufon-yui.js"></script>
<script type="text/javascript" src="js/cufon-titillium-600.js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>

<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript" src="js/coin-slider.min.js"></script>



</head>

<body>

<div id="header">
		<div class="login">
		  <div style="position:absolute;top:1px;left:1px;height:0px;width:0px;overflow:hidden">
	      <h1><a href="http://www.greatdirectories.org">best web directories</a></h1><h1><a href="http://www.bestfreetemplates.org">best free templates</a></h1></div>
			<div class="links"></div>
	  </div>
		<ul id="menu">
			<li><a href="home.php">Home page</a></li>
			<li><a href="about_us.php">About us</a></li>
			<li><a href="faq.php">FAQ</a></li>
			<li><a href="sitemap.php">Sitemap</a></li>
			<li><a href="contact_us.php">Contact us</a></li>
		</ul>
	</div>
	<div id="wrapper">
      <div id="sidebar">
         <div class="logo_block"><a href="#"><img src="images/homelogo.png" alt="setalpm" width="165" height="160" /></a><br />
            <span class="slogan">
            <marquee direction="left" behavior="scroll" align="absmiddle" style="border:thick" truespeed="truespeed">
            <strong><em>B</em>est <em>S</em>ervices <em>F</em>or <em>Y</em>ou</strong>
            </marquee>
            </span>
            <p class="text1"></p>
        </div>
      </div>
	  <div id="content">
        <div class="slider">
          <div id="coin-slider"><a href="#"><img src="images/index-image1.jpg" width="746" height="313" alt="" /></a><a href="#"><img src="images/scroll2.jpg" width="746" height="313" alt="" /> </a><a href="#"><img src="images/services_management[1].png" width="746" height="313" alt="" /> </a> </div>
          <div class="clr"></div>
        </div>
	    <div class="bg">
	      <div class="column1">
		  <table width="493">
		    <tr><td>
            <h1><strong>Tanent Register</strong></h1>
            <!--<h4 align="right"><font color="#FF0000"><strong>*</strong></font><strong>Indicates Required Fields</strong></h4> -->
            <br /></td></tr></table>
            <form method="Get" action="con_update_tanent.php">
			<?php
			
$con= mysql_connect("localhost","root","root");
if(!$con)
{
	die('could not connect: ' . mysql_error());
}

mysql_select_db("ccs_easyrentcollect", $con);
$id=$_GET["id"];
echo $id;

$query="select * from ccs_tanent where tanent_id=".$id."";

$result=mysql_query($query) or die ("error in query");
echo mysql_num_rows($result);
if (mysql_num_rows($result)>0)
{
	$row=mysql_fetch_object($result);
	
}
?>
			
              <table width="258" height="1042" align="center" style="width: 300px; height: 260px; font-weight: bold; font-family: Cambria;"> 
                <tr>
                  <td bgcolor="#FFFFFF" style="width: 371px"><img height="12" alt="*" src="register_clip_image001.gif" width="12" /> <span style="color: #ff9900"><font size="+1">Tanent Information:</font></span><br />
                      <table width="628" style="width: 538px; height: 114px">
					   <tr>
                          
        <td width="256" style="width: 258px"><font size="2">Tanent Name:</font></td>
                          <td width="270"><input type="text" name="txttanent" value="<?php echo $row->tanent_name; ?>"/></td>
                        </tr>
						 <tr>
                          
        <td width="256" style="width: 258px"><font size="2">Email_Id:</font></td>
                          <td><input type="text" name="txttanentmail" value="<?php echo $row->email_id; ?>"/></td>
                        </tr>
                        <tr>
                          
        <td style="width: 258px"><font size="2">Contact No:</font></td>
                          <td><input type="text"name="txttanentcontact" value="<?php echo $row->contact_no; ?>"/></td>
                        </tr>
						<tr></tr><tr></tr>
				 <tr><td align="center" colspan="2">
                     <font size="4" face="Verdana, Arial, Helvetica, sans-serif" color="#000000" >
					  <input name="btntanent" type="submit" value="Update Tanent" /> </font></td>
			    </tr>

                        
                    </table></td>
                </tr>
</table>
</form>
</body>
</html>

i want to pass the texbox data from this page to the following page

<html>
<head>
<title>con_update_tanent</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form methd="get" action="view_tanent.php">
<?php
$con= mysql_connect("localhost","root","root");
if(!$con)
{
	die('could not connect: ' . mysql_error());
}

mysql_select_db("ccs_easyrentcollect", $con);
$id=$_GET["id"];
echo $id;
//$id=$_POST["tanent_id"];
$name=$_GET['txttanent'];
$email=$_GET['txttanentmail'];
$contactno=$_GET['txttanentcontact'];

$sql = "UPDATE `ccs_tanent` SET `tanent_name`=".$name.", `email_id`=".$email.",`contact_no`=".$contactno." WHERE `tanent_id`=" . $id ."";

// UPDATE signifies that we want to update.
// SET defines what we need updated. The syntax here is `collumn`='value'.
// WHERE defines what row we want updated. $id is from the last example.
// LIMIT explains that we just want one row to be updated.
$query = mysql_query($sql); // Perform the update.
if (!$query) { // If the update fails:

    exit("The update failed.");
    }

///You can now assume that the update was successful.

echo '<script type="text/javascript"> alert("Update successfull");location.href="view_tanent.php";</script>';

//exit("The update succeeded.");

?>

</form>
</body>
</html>

i am getting error in the second code in these statements

$name=$_GET['txttanent'];
$email=$_GET['txttanentmail'];
$contactno=$_GET['txttanentcontact'];

the error is undefined txttanent
please help me to solve the issue
thank you

Recommended Answers

All 3 Replies

Have you checked that you are actually receiving the data in the 2nd page, either by looking at the url or by var_dump($_GET)?

yes i have checked it i am getting data on the other page by URL

I can't actually see what might be wrong apart from you have a form around your php and query for some reason which isn't required. Try removing the form tags on the 2nd page.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.