Hello Everyone,
I'm very new to php and MySQL. I have dabled with some code but have any major scripts done for me by a contract programmer who has found full time work and is no longer available to me.
I have a form that should update the database however it doesn't work and I can't figure out why. Any help would be greatly appreciated.
Form on first page looks like this Form on first page looks like this
<form name="form1" method="post" action="updatelink.php">
<input type="text" name="linktext" value="<? echo $row['itemtext'];?>"> <br>
<input name="linkurl" type="text" size="45" maxlength="255" value="<? echo $row['itemurl'];?>"> <br>
<input type="radio" name="opennewwindow" value="Yes" <? if($row['itemnewwindow']) echo "checked"?>> Yes
<input name="opennewwindow" type="radio" value="radiobutton" <? if(!$row['itemnewwindow']) echo "checked"?>>
No <br>
<input type="radio" name="boldlink" value="Yes" <? if($row['itembold']) echo "checked"?>>
Yes
<input name="boldlink" type="radio" value="No" <? if(!$row['itembold']) echo "checked"?>>
No <br>
<input type="hidden" name="item" value="<? echo $_GET['link']; ?>">
<input type="submit" name="Submit" value="Submit">
</form>
Code on second page looks like this
<?
include("common.inc.php");
$itemtext=$POST['linktext'];
$itemurl=$POST['linkurl'];
if($POST['opennewwindow'] == "Yes") { $newwindow=1; } else { $newwindow=0; }
if($POST['boldlink'] == "Yes") { $boldlink=1; } else { $boldlink=0; }
$query = "UPDATE ic_leftmenu SET itemtext='".$POST['linktext']."', itemurl='".$itemurl."', itemnewwindow='".$newwindow."', itembold='".$boldlink."'"
." WHERE itemrank=".$POST['item'];
//echo $query;
$result = @($query);
header("location: managelink.php");
?>
the include("common.inc.php"); is a file that connects to the db
I have absolutely no clue what's wrong. I've tried a few things I've picked up from this forum but nothing works. I don't get an error however the information does not change in the database.
I use phpMy Admin to view the datbase!
Thanks in advance for any help.