Page 1 of 1

update form does NOTHING.

Posted: Tue Feb 07, 2006 4:30 pm
by $var
i'm having the darnedest time figuring out why this update form does NOTHING... can someone look and see if they see something glaring?
(note, i trimmed the massive code down to fit here):

Code: Select all

if($_POST['bpress']=="update")
	        {		
		$sql = "UPDATE it_issues SET
		Issue_Read = '".$_POST["read"]."'															
		WHERE Issue_ID=".$issueID;
		if(!$result = mysql_query($sql))
		{
			echo mysql_error();
		}
		exit;
         	}
                <form name="nav" method="post">
		<input type="hidden" name="bpress" value="">
		    <?php
			$read = "1";																														
			?>    
		  <input name="read" type="hidden" class="text" id="read" value="<? echo $read; ?>" />
                  <input name="update" type="button" onclick="return validate(this.form);" value="Update" /></td>
                  <input name="back" type="button"  onclick="window.location.href='list_it.php';" value="Back" />&nbsp;</td>
                  </form>

Posted: Tue Feb 07, 2006 5:34 pm
by feyd
have you verified that the javascript you run is working and setting bpress to "update" ?

Posted: Tue Feb 07, 2006 5:44 pm
by raghavan20
I do not see you using a submit button, you are using INPUT button type instead of INPUT submit type.

Posted: Tue Feb 07, 2006 7:40 pm
by $var
i did remove the javascript, and it didn't work...
and it's the same button i'm using on all my other pages... i just don't see where the f*ing issue is.

i'll fiddle more and come back to it.

Posted: Tue Feb 07, 2006 8:18 pm
by feyd
tried using <button> instead?

Posted: Wed Feb 08, 2006 9:46 am
by $var
So, I did the <Button> and it is at least doing something now.
This is so bizarre... now it basically refreshes the page...

I did a print_r($sql);, but nothing comes up, and nothing in the database is changed.

This is what I currently have:

Code: Select all

<?
        $issueID = $_GET['ID'];
	$read = "1";	
	if($_POST["bpress"]=="update")
	{
		$sql = "UPDATE it_issue SET 
		Issue_Read='".$_POST["read"]."'				
		WHERE Issue_ID=".$issueID;
		if(!$result = mysql_query($sql))
		{
			echo mysql_error();
		}	
		print_r($sql);
		exit;
	}
	?>

Code: Select all

<form name="nav" method="post">
        <BUTTON TYPE=SUBMIT value="Update" name="update" id="update">
		Update
		</BUTTON>
        <input type="hidden" name="bpress" value="">
        <input type="hidden" name="ID" value="<? echo $issueID; ?>">
		<input type="hidden" id="read" name="read" value="<? echo $read; ?>" />
        </form>

So... the <Button> is resonding, but why won't it go through?

Posted: Wed Feb 08, 2006 9:52 am
by feyd
your new page code doesn't alter bpress, so your php will not be run.

Posted: Wed Feb 08, 2006 10:04 am
by $var
okay, so i just scrapped it and started over with existing update code i have...
and it works now...

does the placement of a form information affect perhaps? that is what it appears to me.

and i am using the input update, and not the submit button.

Posted: Wed Feb 08, 2006 10:06 am
by feyd
I haven't had issues with ordering per se, but if the page is run in standards mode, and you break a standard regarding the form, data may not be sent by the browser if it's conforming.