Problem with declarations

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

 



I run a script and I get a error message stating I cannot redeclare a function.  
Another issue I do not understand while DWMX is putting in 'Connections/addrbk.php'  when I do not have have this as a path or anything of the sort on the server.  I have to constantly go in and change this.  If there are any DWMX users on the list maybe you may some insight.

The script is as follows:
<?php require_once('Connections/addrbk.php'); ?>
<?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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
  $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO tbl_Addr (Client, Business, Addr, City, PCode, OfcPhone, OfcFax, Notes, Mobile, HmPhne, CustID) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($HTTP_POST_VARS['Client'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['Business'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['Addr'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['City'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['PCode'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['OfcPhone'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['OfcFax'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['Notes'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['Mobile'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['HmPhne'], "text"),
                       GetSQLValueString($HTTP_POST_VARS['CustID'], "int"));

  mysql_select_db($database_addrbk, $addrbk);
  $Result1 = mysql_query($insertSQL, $addrbk) or die(mysql_error());

  $insertGoTo = "http://192.168.1.3";;
  if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
  <table align="center">
    <tr valign="baseline"> 
      <td nowrap align="right">Client:</td>
      <td><input type="text" name="Client" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap align="right">Cotact:</td>
      <td><input type="text" name="Business" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap align="right">Address:</td>
      <td><input type="text" name="Addr" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap align="right">City:</td>
      <td><input type="text" name="City" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap align="right">Post Code:</td>
      <td><input type="text" name="PCode" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap align="right">Office Ph:</td>
      <td><input type="text" name="OfcPhone" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap align="right">Ofifce Fax:</td>
      <td><input type="text" name="OfcFax" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap align="right">Notes:</td>
      <td><input type="text" name="Notes" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap align="right">Mobile:</td>
      <td><input type="text" name="Mobile" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap align="right">Home Ph:</td>
      <td><input type="text" name="HmPhne" value="" size="32"></td>
    </tr>
    <tr valign="baseline"> 
      <td nowrap align="right">&nbsp;</td>
      <td><input type="submit" value="Insert Record"></td>
    </tr>
  </table>
  <input type="hidden" name="CustID" value="">
  <input type="hidden" name="MM_insert" value="form1">
</form>
<p>&nbsp;</p>
  

</body>
</html>


Jon L. Miller, MCNE, CNS
Director/Sr Systems Consultant
MMT Networks Pty Ltd
http://www.mmtnetworks.com.au

"I don't know the key to success, but the key to failure
 is trying to please everybody." -Bill Cosby




-- 
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