yardım değiştirici "stok" gerekiyor

1 Cevap php

i tek bir sayfada birden fazla form yönetmek işlevi "içine yerleştirin" Dreamweaver CS4 kullanıyorum. ama zorluk kodunu düzenleyerek yaşıyorum böylece:

  1. tabloya formdan uçlar verileri
  2. retrieves the kimlik of the newly added row
  3. echoes a confirmation message on the same page and a link containing the kimlik (as a reference)

Burada şimdiye kadar bana verdiği ne dreamweaver ... o sadece veritabanına yeni bir satır eklemek gerekir (denenmemiş):

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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"] == "form")) {
  $insertSQL = sprintf("INSERT INTO tbl_solicitors (solicitorName, solicitorDetail) VALUES (%s, %s)",
                       GetSQLValueString($_POST['solicitorName'], "text"),
                       GetSQLValueString($_POST['solicitorDetail'], "text"));

  mysql_select_db($database_speedycms, $speedycms);
  $Result1 = mysql_query($insertSQL, $speedycms) or die(mysql_error());
}
?>

Herhangi bir yardım mutluluk duyacağız ... teşekkürler ve mutlu Yeni Yıl!

1 Cevap

ben bir çözüm buldum endişelenmeyin ... i aşina değilim kodunu kullanmaya karar verdi!

Tho kontrol için teşekkürler!

if (array_key_exists('solicitor',$_POST)) {
            $solicitorName = $_POST['solicitorName'];
            echo "The record for <b>$solicitorName</b> has been successfully added to the database.<p>
            <a href='#' class='form'>View details</a><p>
            <a href='instructus.php' class='form'>Create a new record</a>
            ";
            exit;
            };