AntonioKos
Newbie | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Извините.Вот код: <?php require_once('../../Connections/Antonio.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $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"] == "form1")) { $insertSQL = sprintf("INSERT INTO Sotrudniki (Tab_num, FIO, Date_roz, Otdel, Image) VALUES (%s, %s, %s, %s, %s)", GetSQLValueString($_POST['text_TAB'], "int"), GetSQLValueString($_POST['text_FIO'], "text"), GetSQLValueString($_POST['text_DR'], "date"), GetSQLValueString($_POST['text_Otdel'], "text"), GetSQLValueString($_POST['file_LOAD'], "double")); mysql_select_db($database_Antonio, $Antonio); $Result1 = mysql_query($insertSQL, $Antonio) or die(mysql_error()); } ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" /> <title>Добавление нового сотрудника</title> <style type="text/css"> <!-- .style1 { font-size: 18px; color: #000000; font-weight: bold; } --> </style> </head> <body> <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form1" id="form1"> <label> <br /> <span class="style1">Введите даннные нового сотрудника</span><br /> <br /> </label> <table width="811" border="0"> <tr> <th width="202" align="left" scope="col">Табельный номер</th> <th width="251" align="left" scope="col"><input name="text_TAB" type="text" id="text_TAB" size="24" /></th> <th width="344" align="left" scope="col"> (Например: 0000001)</th> </tr> <tr> <th align="left" valign="middle">ФИО</th> <td><input name="text_FIO" type="text" id="text_FIO" size="40" /></td> <th align="left">(Например: Иванов Иван Иванович) </th> </tr> <tr> <th align="left" valign="middle">Паспортные данные</th> <td><input type="text" name="text_Pasport" id="text_Pasport" /></td> <th align="left"><label> </label> (Например 4010 123456)</th> </tr> <tr> <th align="left" valign="middle">Дата рождения</th> <td><input type="text" name="text_DR" id="text_DR" /></td> <th align="left">(Формат: год-месяц-день, 1990-12-25)</th> </tr> <tr> <th align="left" valign="middle">Должность</th> <td><input type="text" name="text_Dolznostb" id="text_Dolznostb" /></td> <th align="left">(Например: Инженер)</th> </tr> <tr> <th align="left" valign="middle">Отдел</th> <td><input type="text" name="text_Otdel" id="text_Otdel" /></td> <th align="left">(Например: 51 отдел,503 сектор)</th> </tr> <tr> <th align="left" valign="middle"><label>Добавить изображение</label></th> <td> <input name="file_LOAD" type="file" id="file_LOAD" size="24" /> <label></label></td> <th align="left"> </th> </tr> </table> <p> <label></label> </p> <label><br /> </label> <p> <label></label><label> <input type="submit" name="button" id="button" value="Добавить" /> </label> <label> <input type="reset" name="button2" id="button2" value="Сброс" /> </label> </p> <input type="hidden" name="MM_insert" value="form1" /> </form> <p> </p> </body> </html> |