Jump to content

I Have A Problem In Updation Please Solve


furqan219

Recommended Posts

hi this is code of form in which i have populated data from databse.

<form action="update.php" method="post"><input type="text" name="userdate" value="<?= $b ?>" /> <input type="submit" name="subjoin" value="Update"></form>

and update.php

 $c= $_POST["$b"];echo "value".$c; //its not working

but it does not post a value

Link to comment
Share on other sites

the data is stored under the name... you need to either change the name from "userdate" to "b" in the form AND change $_POST["$b"] to $_POST["b"] in update.phpor change $_POST["$b"] to $_POST["userdate"] in update.php

Link to comment
Share on other sites

this is a code

<?php$con = mysql_connect("localhost","xxx","xxx");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("onm", $con);$c= $_POST['name'];echo $c;echo "0play";/*mysql_query("UPDATE SitePInfo SET Age = '36'WHERE FirstName = 'Peter' AND LastName = 'Griffin'");*/mysql_close($con); ?>

Link to comment
Share on other sites

<?$con = mysql_connect("localhost","xxxx","xxxx");if (!$con)  {  die('Could not connect: ' . mysql_error());  }mysql_select_db("onm", $con);$result = mysql_query("SELECT * FROM sitepinfoWHERE SiteId='C-SIL-4441' "); // I just get one value at this timewhile($row = mysql_fetch_array($result))  {  echo "<table cellpadding=2 cellspacing=2 width=100%><tr></tr>";  echo "<tr>";  echo "<th bgcolor=#5D9BCC >SiteID</th>";  echo "<td bgcolor=#FEE9A9>" . $row['SiteId'] . "</td>"; // show value in cell  $b =$row['SiteId']; // store value in $b        echo "</tr>";   }echo "</table>";mysql_close($con);?><form action="update.php" method="post" name="frmmain" id="frmmain"><!-- <input name="hdnSiteID" type="text" id="hdnSiteID" value="<?php print($b);?>" />--><input type="text" name="name" value="<?= $b ?>" /> <input type="submit" name="subjoin" value="Update"></form>

Link to comment
Share on other sites

did you change form to this then :

<form action="update.php" method="post"><input type="text" name="name" value="<?= $b ?>" /><input type="submit" name="subjoin" value="Update"></form>

EDIT: nvm i see you posted the form

Link to comment
Share on other sites

<input type="text" name="name" value="<?php echo $b; ?>" />and... the update page should not be "blank" as far as i can tell :S(should at the very least see "0play" or an error msg)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...