Re: form not working...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i'd be curious what your actual problem is?

here's a question though.,...would these ever work?.....
<<<<<snip>>>>>>>
if ((!isset($_POST['edit'])) or ($_POST = "")) {
 $_SESSION['table'] = "t_items";
 call_user_func("db_retrieve");
} elseif ((isset($_POST['edit'])) or (!$_POST = "")) {
<<<<<</snip>>>>>>>

You're basically setting a superglobal array equal to an empty string ->
 "".  this should at least be $_POST == ""...but....
instead, i'd use....
if ((!isset($_POST['edit'])) or (empty($_POST)) {
<--and -->
} elseif ((isset($_POST['edit'])) or (!empty($_POST))) {

hth
jeff



                                                                                                                                        
                      "jas"                                                                                                             
                      <jlgerfen@hotmail        To:       php-db@xxxxxxxxxxxxx                                                           
                      .com>                    cc:                                                                                      
                                               Subject:   form not working...                                                   
                      11/10/2003 12:38                                                                                                  
                      PM                                                                                                                
                                                                                                                                        
                                                                                                                                        




For some reason my form to edit selected items is not working, I think I
need a new set of eyes.
Any help is appreciated...
Jas

// inc.php
function db_retrieve() {
 require 'dbase.inc.php';
 $tble = $_SESSION['table'];
 $show = @mysql_query("SELECT * FROM $tble LIMIT 0, 15",$db)or
die(mysql_error());
   while ($row = @mysql_fetch_array($show)) {
    @list($nItemSKU, $bActive, $nUserID, $nItemConfig, $tItemType,
$tDepartment, $blSerialNumber, $nPropertyNumber, $blHostName, $nIPID,
$tRoomNumber, $tNotes) = $row;
     $_SESSION['table'] .= "<tr class=fntMAIN><td valign=top
align=left>$nItemSKU</td>
             <td valign=top align=left>$bActive</td>
             <td valign=top align=left>$nUserID</td>
             <td valign=top align=left>$nItemConfig</td>
             <td valign=top align=left>$tItemType</td>
             <td valign=top align=left>$tDepartment</td>
             <td valign=top align=left>$blSerialNumber</td>
             <td valign=top align=left>$nPropertyNumber</td>
             <td valign=top align=left>$blHostName</td>
             <td valign=top align=left>$nIPID</td>
             <td valign=top align=left>$tRoomNumber</td>
             <td valign=top align=left>$tNotes</td>
             <td valign=top align=left><input name=edit type=checkbox
value=$blSerialNumber></td>
            </tr>"; }
 $_SESSION['number'] = mysql_num_rows($show); }

<?php
session_start();
require 'scripts/inc.php';
if ((!isset($_POST['edit'])) or ($_POST = "")) {
 $_SESSION['table'] = "t_items";
 call_user_func("db_retrieve");
} elseif ((isset($_POST['edit'])) or (!$_POST = "")) {
 require 'scripts/dbase.inc.php';
  $tble = $_SESSION['table'];
  $edt = mysql_query("SELECT * FROM $tble WHERE
blSerialNumber=\"$edit\"",$db)or die(mysql_error());
   while ($row = mysql_fetch_array($edt)) {
    list($nItemSKU, $bActive, $nUserID, $nItemConfig, $tItemType,
$tDepartment, $blSerialNumber, $nPropertyNumber, $blHostName, $nIPID,
$tRoomNumber, $tNotes) = $row;
    $_SESSION['table'] .= "<tr class=fntMAIN>
           <td valign=top align=left><input name=nItemSKU type=text size=30
value=$nItemSKU></td>
           <td valign=top align=left><input name=bActive type=text size=30
value=$bActive>$bActive</td>
           <td valign=top align=left><input name=nUserID type=text size=30
value=$nUserID>$nUserID</td>
           <td valign=top align=left><input name=nItemConfig type=text
size=30 value=$nItemConfig>$nItemConfig</td>
           <td valign=top align=left><input name=tItemType type=text
           size=30
value=$tItemType>$tItemType</td>
           <td valign=top align=left><input name=tDepartment type=text
size=30 value=$tDepartment>$tDepartment</td>
           <td valign=top align=left><input name=blSerialNumber type=text
size=30 value=$blSerialNumber>$blSerialNumber</td>
           <td valign=top align=left><input name=nPropertyNumber type=text
size=30 value=$nPropertyNumber>$nPropertyNumber</td>
           <td valign=top align=left><input name=blHostName type=text
size=30 value=$blHostName>$blHostName</td>
           <td valign=top align=left><input name=nIPID type=text size=30
value=$nIPID>$nIPID</td>
           <td valign=top align=left><input name=tRoomNumber type=text
size=30 value=$tRoomNumber>$tRoomNumber</td>
           <td valign=top align=left><input name=tNotes type=text size=30
value=$tNotes>$tNotes</td>
           <td valign=top align=left><input name=save type=button
           value=Save
class=frmBTNS></td>
          </tr>"; }
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<?php echo $_SESSION['table']; ?>
<input name="edit" type="button" value="edit selected items"
class="frmBTNS">
</form>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux