Hi, I'm trying to use the update feature to allow users of my website to change information they have entered.
Heres my form, radio buttons and submit button.
<form name="Form1" method="post" action="FixedAssetReview_ac.php?id=<? echo $id; ?>">
<label><input name="EntryBalanceSheet" id="Intangible" type="radio" value="1"
<? if ($viewOnly == true)
{
?>
disabled="true"
<?
}
?>
<?
if ($entryBalanceSheet == 1)
{
?>
checked="checked"
<?
}
?>
/>
Intangible</label><label>
<input name="EntryBalanceSheet" id="Tangible" type="radio" value="2"
<? if ($viewOnly == true)
{
?>
disabled="true"
<?
}
?>
<?
if ($entryBalanceSheet == 2)
{
?>
checked="checked"
<?
}
?>
/>
Tangible</label>
</font>
<input type="submit" name="Submit" value="Submit"></input></form>
So when I click the submit button, it loads up FixedAssetReview_ac.php as it should, heres what this looks like.
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
$sql="UPDATE Entry SET EntryBalanceSheet='$EntryBalanceSheet' WHERE EntryID=$id";
$result=mysql_query($sql);
if($result){
echo "Successfully Edited";
echo "<BR>";
echo "<a href='FixedAssetRegister.php'>View result</a>";
}
else {
echo "ERROR";
}
It loads this up correctly and gives me the sucessful message, but it changes the value to 0.
Let me explain better, the row which im trying to change in my database table is called 'EntryBalanceSheet', this row holds numeric values, 1 = Intangible and 2 = Tangible.
When I click on an entry in the database and try change it, it always changes the value to '0' but still gives the sucessful message.
I apoligize about the messy coding and I appreciate any help.