Page 1 of 1

$_post with ajax

Posted: Fri Oct 10, 2008 7:59 pm
by shadwise
Hi everybody,
i dont know if i am at the right place!!!
im trying to do some php code with ajax......i have a problem....i want search in my database by name.....when i load my php code in my ajaxdiv they dont work at all.....

here is my code in my html file
<html>
<body>
<form method="post" action="javascript:display('http.get.nocache','detail','findbyname.php')">
<center>Entrez le nom rechercher
<table align='center'><tr><td><input name="name"></td></tr></table>
<input type='submit' value='Rechercher' ></center>
</form>
</body>
</html>

here is my code in my php file
<?php /* Created on: 10/10/2008 */ ?>
<html>
<body>
<?php
include("connexion.php");
$sql = "Select * from individu where nom = ' ".$_POST['name']. " ' ";
$query = mysql_query($sql) or die("Impossible d'executer la requete");
$row = mysql_num_rows($query);
if($row>0)
{
echo ("<table><tr><td>NOM</tr><td>");
for($i=0;$i<$row;$i++)
{
$ligne = mysql_fetch_array($query);
extract($ligne);
echo "<tr><td>$Nom</td></tr>";
}
echo "</table>";
}
else
echo ('Bonjour');

?>
</body>
</html>

i have tried in many different solutions.....no work.....


only thing i was enable to work it is......if i change my from action...in my html file for action="findbyname.php"......but i dont want to do that because they will open a new windows explorer or open in the same windows and remove my menu at the top

is ayone here can help me?????

thanks you