update form does NOTHING.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
$var
Forum Contributor
Posts: 317
Joined: Thu Aug 18, 2005 8:30 pm
Location: Toronto

update form does NOTHING.

Post 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>
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

have you verified that the javascript you run is working and setting bpress to "update" ?
User avatar
raghavan20
DevNet Resident
Posts: 1451
Joined: Sat Jun 11, 2005 6:57 am
Location: London, UK
Contact:

Post by raghavan20 »

I do not see you using a submit button, you are using INPUT button type instead of INPUT submit type.
User avatar
$var
Forum Contributor
Posts: 317
Joined: Thu Aug 18, 2005 8:30 pm
Location: Toronto

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

tried using <button> instead?
User avatar
$var
Forum Contributor
Posts: 317
Joined: Thu Aug 18, 2005 8:30 pm
Location: Toronto

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

your new page code doesn't alter bpress, so your php will not be run.
User avatar
$var
Forum Contributor
Posts: 317
Joined: Thu Aug 18, 2005 8:30 pm
Location: Toronto

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply