Witam,
mam dziwny problem i nie mogę go rozgryźć.
Poniższy kod zapisuje do bazy tylko i wyłącznie cyfry, jeśli zostają pobrane z formularza litery zapis już się nie odbywa. W czym jest problem?(IMG:
style_emoticons/default/questionmark.gif)
function showUser(str,str2)
{
if (str=="" & str2=="")
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","test4.php?q="+str+"&w="+str2,true);
xmlhttp.send();
}
<form method="post" action=""> <Input type="text" name="autor" id="autor" class="autor" required placeholder="Autor..."></input><br> <Input type="text" name="text" id="text" class="text" required placeholder="Text..."></input><br>
<input type="" id="submit" value="Submit" onclick="showUser(autor.value,text.value)">
<div id="txtHint"><b>Person info will be listed here.
</b></div>
<?php
$q = $_GET['q'];
$w = $_GET['w'];
require_once ('functions.php');
connect($adres, $user, $pass, $baza);
$ins = @mysql_query("INSERT INTO komentarze SET autor='$q', tresc='$q', post=$w");
koniec($adres, $user, $pass);
?>
Ten post edytował kamilo818 20.01.2014, 08:17:51