Jump to content

I Have A Problem In Updation Please Solve


furqan219
 Share

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

Edited by smerny
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

Edited by smerny
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)

Edited by smerny
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...