ciao a tutti
qualcuno può aiutarmi con questo script?
come faccio a far si che ogni carattere anche quelli speciali (','',#@ etc...)
vengano letti come semplici caratteri html?
per ora ho provato cosi ma non funziona ,se inserisco il carattere (') nella form ho preblemi con le query
Codice PHP:
<?php
$data=date("d-m-y");
$orario=date("H:i:s");
include("db_connect.php");
if($_POST['nome']&&$_POST['cognome']&&$_POST['email']&&$_POST['password']&&$_POST['scelta']&&$_POST['commento'] !='' )
{
$nome =htmlspecialchars($_POST['nome']);
$cognome=htmlspecialchars($_POST['cognome']);
$email=htmlspecialchars($_POST['email']);
$password=htmlspecialchars($_POST['password']);
$scelta=htmlspecialchars($_POST['scelta']);
$commento=htmlspecialchars($_POST['commento']);
$query="SELECT nome,cognome FROM preventivi WHERE nome='$nome'AND cognome='$cognome'";
$res= mysql_query($query);
$num_rows=mysql_num_rows($res);
switch($num_rows)
{
case "0":
$query=mysql_query("INSERT INTO preventivi(nome,cognome,email,password,scelta,commento,data,orario,risposta) VALUES('$nome','$cognome','$email','$password','$scelta','$commento','$data','$orario','no') ") or die(mysql_error('compila per bene i campi'));
echo '<a style="color:#ff0000;">Dati inseriti</a>';
break;
case "1":
echo '<a style="color:#ff7600;">Dati già esistenti</a>';
break;
}
}
else{echo'<a style="color:#ff5600;">Devi riempire tutti campi</a>';}
?>
grazie a chi mi aiuta