Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Having a brain fart.

Status
Not open for further replies.

VAMick

Programmer
Nov 18, 2005
64
US
Ok, I have a simple form that dynamically lists a document and a quantity that a customer subscribes too. They are listed in table form on a page. I have a simple form included that allows the user to either update the quantity or delete the document from the list altogether. Here's the thing, the update part works, delete does nothing. Can someone post what my code should relatively look like to have multiple submit buttons triggering either the update query or the delete query. THANKS a ton.
 
Sure thing, sorry if it's a bit of a visual mess...

The specific line for the delete is commented as
/* Delete the publist from customer */

Code:
<?php require_once('Connections/moms.php'); ?>
<?php
session_start();
$MM_authorizedUsers = "admin,user";
$MM_donotCheckaccess = "false";

// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False; 

  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) { 
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers); 
    $arrGroups = Explode(",", $strGroups); 
    if (in_array($UserName, $arrUsers)) { 
      $isValid = true; 
    } 
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) { 
      $isValid = true; 
    } 
    if (($strUsers == "") && false) { 
      $isValid = true; 
    } 
  } 
  return $isValid; 
}

$MM_restrictGoTo = "sorry.htm";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0) 
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo); 
  exit;
}
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form3")) {
  $insertSQL = sprintf("INSERT INTO moms_lists (custnumber, pubid, quantity) VALUES (%s, %s, %s)",
                       GetSQLValueString($_POST['custnumber'], "int"),
                       GetSQLValueString($_POST['pubid'], "int"),
                       GetSQLValueString($_POST['quantity'], "int"));

  mysql_select_db($database_moms, $moms);
  $Result1 = mysql_query($insertSQL, $moms) or die(mysql_error());
}


$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE moms_customer SET title=%s, firstname=%s, middleinitial=%s, lastname=%s, routingsymbol=%s, companyname=%s, department=%s, street1=%s, street2=%s, city=%s, `state`=%s, zipcode=%s, zip4=%s, country=%s, countrycode=%s, phone=%s, mode=%s, custtype=%s, facility=%s, region=%s WHERE custnumber=%s",
                       GetSQLValueString($_POST['title'], "text"),
                       GetSQLValueString($_POST['firstname'], "text"),
                       GetSQLValueString($_POST['middleinitial'], "text"),
                       GetSQLValueString($_POST['lastname'], "text"),
                       GetSQLValueString($_POST['routingsymbol'], "text"),
                       GetSQLValueString($_POST['companyname'], "text"),
                       GetSQLValueString($_POST['department'], "text"),
                       GetSQLValueString($_POST['street1'], "text"),
                       GetSQLValueString($_POST['street2'], "text"),
                       GetSQLValueString($_POST['city'], "text"),
                       GetSQLValueString($_POST['state'], "text"),
                       GetSQLValueString($_POST['zipcode'], "text"),
                       GetSQLValueString($_POST['zip4'], "text"),
                       GetSQLValueString($_POST['country'], "text"),
                       GetSQLValueString($_POST['countrycode'], "text"),
                       GetSQLValueString($_POST['phone'], "text"),
                       GetSQLValueString($_POST['mode'], "text"),
                       GetSQLValueString($_POST['custtype'], "text"),
                       GetSQLValueString($_POST['facility'], "text"),
                       GetSQLValueString($_POST['region'], "text"),
                       GetSQLValueString($_POST['custnumber'], "int"));

  mysql_select_db($database_moms, $moms);
  $Result1 = mysql_query($updateSQL, $moms) or die(mysql_error());

  $updateGoTo = "editcust2.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) {
  $updateSQL = sprintf("UPDATE moms_lists SET quantity=%s WHERE lid=%s",
                       GetSQLValueString($_POST['quantity'], "int"),
                       GetSQLValueString($_POST['lid'], "int"));

  mysql_select_db($database_moms, $moms);
  $Result1 = mysql_query($updateSQL, $moms) or die(mysql_error());

  $updateGoTo = "editcust2.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}
/* Delete the publist from customer */
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2") && ($_POST["Submit"] == "delete")) {
   $sql = sprintf("DELETE FROM moms_lists WHERE lid=%s",
  GetSQLValueString($_POST['lid'], "int"));
  mysql_select_db($database_moms, $moms);
}

/* End delete code */
$SSAdv_colors1 = array("#e0e0e0","#FFFFFF");
$SSAdv_k1 = 0;
$SSAdv_m1 = 0;
$SSAdv_change_every1 = 1;

$colname_rs_custedit = "1";
if (isset($_GET['custnumber'])) {
  $colname_rs_custedit = (get_magic_quotes_gpc()) ? $_GET['custnumber'] : addslashes($_GET['custnumber']);
}
mysql_select_db($database_moms, $moms);
$query_rs_custedit = sprintf("SELECT * FROM moms_customer WHERE custnumber = %s", $colname_rs_custedit);
$rs_custedit = mysql_query($query_rs_custedit, $moms) or die(mysql_error());
$row_rs_custedit = mysql_fetch_assoc($rs_custedit);
$totalRows_rs_custedit = mysql_num_rows($rs_custedit);

$colname_rs_pubedit = "1";
if (isset($_GET['custnumber'])) {
  $colname_rs_pubedit = (get_magic_quotes_gpc()) ? $_GET['custnumber'] : addslashes($_GET['custnumber']);
}
mysql_select_db($database_moms, $moms);
$query_rs_pubedit = sprintf("SELECT * FROM moms_lists WHERE custnumber = %s", $colname_rs_pubedit);
$rs_pubedit = mysql_query($query_rs_pubedit, $moms) or die(mysql_error());
$row_rs_pubedit = mysql_fetch_assoc($rs_pubedit);
$totalRows_rs_pubedit = mysql_num_rows($rs_pubedit);

mysql_select_db($database_moms, $moms);
$query_rs_publist = "SELECT pubid, IF(LENGTH(listtitle)>40,CONCAT(LEFT(listtitle,60),'...'),listtitle) AS trimlisttitle FROM moms_pubtable ORDER BY pubid ASC";
$rs_publist = mysql_query($query_rs_publist, $moms) or die(mysql_error());
$row_rs_publist = mysql_fetch_assoc($rs_publist);
$totalRows_rs_publist = mysql_num_rows($rs_publist);

?>
<?php require_once('Connections/moms.php');
include_once('Connections/functions.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Edit Customer Module</title>
<link href="layout.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {font-size: 10}
body {
	background-color: #D9F1F9;
}
-->
</style>
</head>

<body>
<?php
//if a pub has been deleted,
//remove it from the database.
if (isset($_GET['deletepub'])) {
$lid = $_GET['deletepub'];
$sql = "DELETE FROM moms_lists 
WHERE lid=$lid ";
if (@mysql_query($sql)) {
echo '<p>The Pub has been deleted.</p>';
} else {
echo '<p>Error deleting Pub: ' .
mysql_error() . '</p>';
}
}
?>
<table width="1000" border="0" cellpadding="0" cellspacing="5" class="boxborder">
  <tr bgcolor="#FFFFFF">
    <td height="47" colspan="7"><a href="/moms/index.php"><img src="images/logo_sm.jpg" width="200" height="59" border="0"></a></td>
  </tr>
  <tr>
    <td colspan="6"><?php adminToolbar(); ?></td>
    <td width="479">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="6"><h3><br>
    </h3></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="6" valign="top" ><form name="form1" method="POST" action="<?php echo $editFormAction; ?>">
  <table width="493" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="boxborder">
  <tr>
    <td colspan="2"><h1><strong>Customer Edit Module</strong></h1></td>
    </tr>
  <tr>
    <td colspan="2"><div align="right">Date Added: <?php echo $row_rs_custedit['dateadd']; ?><br>
        Date Modified: <?php echo $row_rs_custedit['datemodified']; ?>
    </div><br>
    Cust No. <?php echo $row_rs_custedit['custnumber']; ?>
		</td>
    </tr>
  <tr>
    <td width="149" class="formpad2">Title</td>
    <td width="451"><input name="title" type="text" id="title" value="<?php echo $row_rs_custedit['title']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">First name </td>
    <td><input name="firstname" type="text" id="firstname" value="<?php echo $row_rs_custedit['firstname']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Middle Initial </td>
    <td><input name="middleinitial" type="text" id="middleinitial" value="<?php echo $row_rs_custedit['middleinitial']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Last name </td>
    <td><input name="lastname" type="text" id="lastname" value="<?php echo $row_rs_custedit['lastname']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Routing Symbol </td>
    <td><input name="routingsymbol" type="text" id="routingsymbol" value="<?php echo $row_rs_custedit['routingsymbol']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Company</td>
    <td><input name="companyname" type="text" id="companyname" value="<?php echo $row_rs_custedit['companyname']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Department</td>
    <td><input name="department" type="text" id="department" value="<?php echo $row_rs_custedit['department']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Street 1 </td>
    <td><input name="street1" type="text" id="street1" value="<?php echo $row_rs_custedit['street1']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Street 2 </td>
    <td><input name="street2" type="text" id="street2" value="<?php echo $row_rs_custedit['street2']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">City</td>
    <td><input name="city" type="text" id="city" value="<?php echo $row_rs_custedit['city']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">State</td>
    <td><input name="state" type="text" id="state" value="<?php echo $row_rs_custedit['state']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Zipcode</td>
    <td><input name="zipcode" type="text" id="zipcode" value="<?php echo $row_rs_custedit['zipcode']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Zip 4 </td>
    <td><input name="zip4" type="text" id="zip4" value="<?php echo $row_rs_custedit['zip4']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Country</td>
    <td><input name="country" type="text" id="country" value="<?php echo $row_rs_custedit['country']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Country code </td>
    <td><input name="countrycode" type="text" id="countrycode" value="<?php echo $row_rs_custedit['countrycode']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Phone</td>
    <td><input name="phone" type="text" id="phone" value="<?php echo $row_rs_custedit['phone']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Mode/OA</td>
    <td><input name="mode" type="text" id="mode" value="<?php echo $row_rs_custedit['mode']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Customer Type </td>
    <td><input name="custtype" type="text" id="custtype" value="<?php echo $row_rs_custedit['custtype']; ?>" size="40"></td>
  </tr>
  <tr>
    <td class="formpad2">Facility</td>
    <td><input name="facility" type="text" id="facility" value="<?php echo $row_rs_custedit['facility']; ?>" size="40">
      <input name="custnumber" type="hidden" id="custnumber" value="<?php echo $row_rs_custedit['custnumber']; ?>" ></td>
  </tr>
  <tr>
    <td class="formpad2">Region</td>
    <td><select name="region" id="region">
      <option value="" selected <?php if (!(strcmp("", $row_rs_custedit['region']))) {echo "SELECTED";} ?>></option>
      <option value="Alaska" <?php if (!(strcmp("Alaska", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>Alaska</option>
        <option value="Central" <?php if (!(strcmp("Central", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>Central</option>
        <option value="Eastern" <?php if (!(strcmp("Eastern", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>Eastern</option>
        <option value="Southern" <?php if (!(strcmp("Southern", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>Southern</option>
        <option value="Southwest" <?php if (!(strcmp("Southwest", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>Southwest</option>
        <option value="Western Pacific" <?php if (!(strcmp("Western Pacific", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>Western Pacific</option>
        <option value="European" <?php if (!(strcmp("European", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>European</option>
        <option value="Washington" <?php if (!(strcmp("Washington", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>Washington</option>
        <option value="New England" <?php if (!(strcmp("New England", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>New England</option>
        <option value="Great Lakes" <?php if (!(strcmp("Great Lakes", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>Great Lakes</option>
        <option value="Northwest" <?php if (!(strcmp("Northwest", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>Northwest</option>
        <option value="Rocky Mountain" <?php if (!(strcmp("Rocky Mountain", $row_rs_custedit['region']))) {echo "SELECTED";} ?>>Rocky Mountain</option>
       </select>
      </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="submit" name="Submit" value="Update">&nbsp;      </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
      <input type="hidden" name="MM_update" value="form1">
    </form></td>
    <td valign="top">
      <table width="380" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="boxborder">
        <tr>
          <td colspan="3"><h1><strong>Pub Id Edit Module </strong></h1></td>
        </tr>
        <tr>
          <td width="266" class="formpad2"><strong>Pub ID </strong></td>
          <td width="31"><strong>Qty</strong></td>
          <td width="81">&nbsp;</td>
        </tr>
        <?php do { ?><form name="form2" method="POST" action="<?php echo $editFormAction; ?>">
        <tr bgcolor="<?php
if($SSAdv_m1%$SSAdv_change_every1==0 && $SSAdv_m1>0){
$SSAdv_k1++;
}
print $SSAdv_colors1[$SSAdv_k1%count($SSAdv_colors1)];
$SSAdv_m1++;
?>">
            <td height="22"><span class="style2 formpad2"><?php echo $row_rs_pubedit['pubid']; ?></span>              <input name="lid" type="hidden" id="lid" value="<?php echo $row_rs_pubedit['lid']; ?>"></td>
            <td><input name="quantity" type="text" class="special" id="special" value="<?php echo $row_rs_pubedit['quantity']; ?>" size="3"></td>
            <td>&nbsp;
              <input name="Submit" type="image" value="edit" src="images/edit.png" alt="Edit" width="16" height="16">              &nbsp;&nbsp;
            <input name="Submit" type="image" value="delete" src="images/red_x.gif" alt="Delete" width="16" height="16"></td>
        </tr>
        <input type="hidden" name="MM_update" value="form2">
    </form>
        <?php } while ($row_rs_pubedit = mysql_fetch_assoc($rs_pubedit)); ?>
      </table>
      <br>
      <table width="380" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" class="boxborder">
        <tr>
          <td><h1><strong>Add a New Pub Id  Module </strong></h1></td>
        </tr>
        <form name="form3" method="POST" action="<?php echo $editFormAction; ?>">
          <tr class="formpad2">
            <td nowrap class="formpad1"><select name="pubid" id="pubid">
              <option value="">Select a Pub ID</option>
			  <?php
do {  
?>
              <option value="<?php echo $row_rs_publist['pubid']?>">ID: <?php echo $row_rs_publist['pubid']?> | <?php echo $row_rs_publist['trimlisttitle']?></option>
              <?php
} while ($row_rs_publist = mysql_fetch_assoc($rs_publist));
  $rows = mysql_num_rows($rs_publist);
  if($rows > 0) {
      mysql_data_seek($rs_publist, 0);
	  $row_rs_publist = mysql_fetch_assoc($rs_publist);
  }
?>
            </select>
Qty:
<input name="quantity" type="text" id="quantity" value="1" size="5">
<input type="submit" name="Submit" value="Add">
<input type="hidden" name="MM_insert" value="form3">
<input name="custnumber" type="hidden" id="custnumber" value="<?php echo $row_rs_custedit['custnumber']; ?>"></td>
          </tr>
        </form>
      </table>
    <p>&nbsp;</p></td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($rs_custedit);

mysql_free_result($rs_pubedit);

mysql_free_result($rs_publist);
?>
 
I use echo (in the same way I use alert in javascript) to help in these instances. Put an echo (or many) inside the if() check to make sure it's actually going into there in the first place. This will help identify at what point the code is not functioning as expected.

You will probably find that this change is required to the delete button...
Code:
<input name="[b]Delete[/b]" type="image" value="delete" src="images/red_x.gif" alt="Delete" width="16" height="16">
And...
Code:
/* Delete the publist from customer */
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2") && ($_POST["[b]Delete[/b]"] == "delete"))

Let us know how you fare!

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Nothing appears to happen with those changes. What would you echo in the if statement??
 
Then I would start echo-ing the criteria you are testing to see why your test is failing. Putting something like this before the if() test:

Code:
/* Delete the publist from customer */
if (isset($_POST["MM_update"])) echo "\n <!-- MM_update = ".$_POST["MM_update"]." --> \n";
if (isset($_POST["Delete"])) echo "\n <!-- Delete = ".$_POST["Delete"]." --> \n";

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2") && ($_POST["Delete"] == "delete")) {
   $sql = sprintf("DELETE FROM moms_lists WHERE lid=%s",
  GetSQLValueString($_POST['lid'], "int"));
  mysql_select_db($database_moms, $moms);
}

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
This is bizarre. Something so simple, should work but doesn't.
Could it have anything to do with the form being replicated row after row?

see code:

Code:
<?php do { ?><form name="form2" method="POST" action="<?php echo $editFormAction; ?>">
        <tr bgcolor="<?php
if($SSAdv_m1%$SSAdv_change_every1==0 && $SSAdv_m1>0){
$SSAdv_k1++;
}
print $SSAdv_colors1[$SSAdv_k1%count($SSAdv_colors1)];
$SSAdv_m1++;
?>">
            <td height="22"><span class="style2 formpad2"><?php echo $row_rs_pubedit['pubid']; ?></span>              <input name="lid" type="hidden" id="lid" value="<?php echo $row_rs_pubedit['lid']; ?>"></td>
            <td><input name="quantity" type="text" class="special" id="special" value="<?php echo $row_rs_pubedit['quantity']; ?>" size="3"></td>
            <td>&nbsp;
              <input name="Submit" type="image" value="edit" src="images/edit.png" alt="Edit" width="16" height="16">              &nbsp;&nbsp;
            <input name="Submit" type="image" value="delete" src="images/red_x.gif" alt="Delete" width="16" height="16"></td>
        </tr>
        <input type="hidden" name="MM_update" value="form2">
    </form>
        <?php } while ($row_rs_pubedit = mysql_fetch_assoc($rs_pubedit)); ?>


As a test, I removed the update and just had the delete function by itself, and still nothing.
 
Stuck. I removed the Edit portion and it now deletes, but when i try to add edit back in, it just deletes. Looks like I can't have the two functions in the same form.
 
how are you determining which button has been pressed?

I believe that browsers submit the coordinates of the pressed input type=image rather than its value (which is completely ignored).

solutions:
either do some javascript to manipulate a hidden field to give you the action value you want
name each input type=image a different thing and test to see which one is pressed (as Jeff suggests above)

i'm sure there are other solutions too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top