Witam mam formularz kontaktowy, który wysyła dane do bazy danych ale po wejściu do bazy danych ucina " 00 " zera
KOD PHP DO FORMULARZA:<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
}
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")) {
if ($_POST['nr_nadania'] == '' || $_POST['imie_rekl'] == '' || $_POST['nazwisko_rekl'] == '' || $_POST['ulica_rekl'] == '' || $_POST['kod_poczt_rekl'] == '' || $_POST['miasto_rekl'] == '' || $_POST['tel_rekl'] == '' || $_POST['mail'] == '' || $_POST['tresc'] == '') {
if($_POST['nr_nadania'] == '') {
$nr_nadania= 'Proszę wprowadzić nr nadania';
}
if($_POST['imie_rekl'] == '' ) {
$imie_rekl = 'Proszę wprowadzić Imię';
}
if($_POST['nazwisko_rekl'] == '') {
$nazwisko_rekl = 'Proszę wprowadzić Nazwisko';
}
if($_POST['ulica_rekl'] == '') {
$ulica_rekl = 'Proszę wprowadzić Ulicę';
}
if($_POST['kod_poczt_rekl'] == '') {
$kod_poczt_rekl = 'Proszę wprowadzić Kod Pocztowy';
}
if($_POST['miasto_rekl'] == '') {
$miasto_rekl = 'Proszę wprowadzić Miasto';
}
if($_POST['tel_rekl'] == '') {
$tel_rekl = 'Proszę wprowadzić Numer Telefonu';
}
if($_POST['mail'] == '') {
$mail = 'Proszę wprowadzić Adres E-mail';
}
if($_POST['tresc'] == '') {
$tresc = 'Proszę wprowadzić Treść Wiadomość';
}
}else {
$insertSQL = sprintf("INSERT INTO reklamacja (nr_nadania, imie_rekl, nazwisko_rekl, ulica_rekl, kod_poczt_rekl, miasto_rekl, tel_rekl, mail, tresc, tem_wiad) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['nr_nadania'], "varchar" ),
GetSQLValueString($_POST['imie_rekl'], "text"),
GetSQLValueString($_POST['nazwisko_rekl'], "text"),
GetSQLValueString($_POST['ulica_rekl'], "text"),
GetSQLValueString($_POST['kod_poczt_rekl'], "text"),
GetSQLValueString($_POST['miasto_rekl'], "text"),
GetSQLValueString($_POST['tel_rekl'], "int"),
GetSQLValueString($_POST['mail'], "text"),
GetSQLValueString($_POST['tresc'], "text"),
GetSQLValueString($_POST['tem_wiad'], "int"));
$insertGoTo = "potw_wysl_kont.php";
if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ?
"&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING'];
}
}
}
$query_kontakt = "SELECT * FROM reklamacja ORDER BY `data` ASC";
?>
FORMULARZ:<form action="<?php echo $editFormAction; ?>" name="form" method="POST" style="margin-top:10px;" >
<table width="493" id="tbl_insert"> <th width="149" scope="col"> </th> <th width="250" scope="col">Proszę wypenić wszystkie pola
</th> <?php if(isset($nr_nadania)){?>
<td class="wrn"><?php echo $nr_nadania; ?></td> <?php } ?>
<th scope="row">Numer nadania
</th> <td><input name="nr_nadania" type="text" class="frmfld" id="nr_nadania" value="<?php getSticky('nr_nadania'); ?>">
</td>
<?php if(isset($imie_rekl)){?>
<td class="wrn"><?php echo $imie_rekl; ?></td> <?php } ?>
<th scope="row">Imię
</th> <td><input name="imie_rekl" type="text" class="frmfld" id="imie_rekl" value="<?php getSticky('imie_rekl'); ?>">
</td>
<?php if(isset($nazwisko_rekl)){?>
<td class="wrn"><?php echo $nazwisko_rekl; ?></td> <?php } ?>
<th scope="row">Nazwisko
</th> <td><input name="nazwisko_rekl" type="text" class="frmfld" id="nazwisko_rekl" value="<?php getSticky('nazwisko_rekl'); ?>">
</td>
<?php if(isset($ulica_rekl)){?>
<td class="wrn"><?php echo $ulica_rekl; ?></td> <?php } ?>
<th scope="row">Ulica
</th> <td><input name="ulica_rekl" type="text" class="frmfld" id="ulica_rekl" value="<?php getSticky('ulica_rekl'); ?>">
</td> <?php if(isset($kod_poczt_rekl)){?>
<td class="wrn"><?php echo $kod_poczt_rekl; ?></td> <?php } ?>
<th scope="row">Kod Pocztowy
</th> <td><input name="kod_poczt_rekl" type="text" class="frmfld" id="kod_poczt_rekl" value="<?php getSticky('kod_poczt_rekl'); ?>">
</td>
<?php if(isset($miasto_rekl)){?>
<td class="wrn"><?php echo $miasto_rekl; ?></td> <?php } ?>
<th scope="row">Miasto
</th> <td><input name="miasto_rekl" type="text" class="frmfld" id="miasto_rekl" value="<?php getSticky('miasto_rekl'); ?>">
</td>
<?php if(isset($mail)){?>
<td class="wrn"><?php echo $mail; ?></td> <?php } ?>
<th scope="row">E-mail
</th> <td><input name="mail" type="text" class="frmfld" id="mail" value="<?php getSticky('mail'); ?>">
</td>
<?php if(isset($tel_rekl)){?>
<td class="wrn"><?php echo $tel_rekl; ?></td> <?php } ?>
<th scope="row">Telefon
</th> <td><input name="tel_rekl" type="text" class="frmfld" id="tel_rekl" value="<?php getSticky('tel_rekl'); ?>">
</td>
<th scope="row">Temat
</th> <td><select name="tem_wiad" class="frmfld"><? foreach ($_tem_wiad as $k=>$w)
{
}?>
<?php if(isset($tresc)){?>
<td class="wrn"><?php echo $tresc; ?></td> <?php } ?>
<th scope="row">Treść
</th> <td><textarea name="tresc" class="frmfld" id="tresc" value="<?php getSticky('tresc'); ?>">
</textarea></td>
<th scope="row"> </th>
<td><input name="btn" type="image" src="images/menu/wyslij.png" id="btn" style="width: 100px;float:right;" value="Wyślij" /></td> <input type="hidden" name="MM_insert" value="form">
BAZA DANYCH KTÓRA TWORZYŁEM
CREATE TABLE `reklamacja` (
`wiad_id` int(11) NOT NULL AUTO_INCREMENT,
`nr_nadania` varchar(20) collate utf8_polish_ci NOT NULL,
`imie_rekl` varchar(15) character SET utf8 NOT NULL,
`nazwisko_rekl` varchar(30) character SET utf8 NOT NULL,
`ulica_rekl` varchar(50) character SET utf8 NOT NULL,
`kod_poczt_rekl` varchar(11) character SET utf8 NOT NULL,
`miasto_rekl` varchar(11) character SET utf8 NOT NULL,
`tel_rekl` int(13) NOT NULL,
`mail` varchar(40) collate utf8_polish_ci NOT NULL,
`data` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`tresc` text collate utf8_polish_ci NOT NULL,
`tem_wiad` int(1) NOT NULL,
PRIMARY KEY (`wiad_id`),
UNIQUE KEY `nr_nadania` (`nr_nadania`)
) ENGINE=MyISAM AUTO_INCREMENT=72 DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=72 ;