Currently i'm abit expirimenting with SAJAX.
I just can get this piece of code to work :P
I'm breaking my head over it for over an hour now :S
I have no idea what's wrong..PHP Code:<?
require("Sajax.php");
$host = "localhost";
$user = "floris";
$pass = "<PASS>";
$db = "testit";
$sql = mysql_connect($host, $user, $pass);
$con = mysql_select_db($db, $sql);
if (!$con)
{
die("Error[". mysql_errno() ."]: ". mysql_error());
}
function send($name) {
$query = mysql_query("INSERT INTO `sajax` VALUES ('$name')"); //I've named my table 'sajax'
if (!$query)
{
die(mysql_error());
}
}
sajax_init();
// $sajax_debug_mode = 1;
sajax_export("send");
sajax_handle_client_request();
?>
<html>
<head>
<title>Test</title>
<script>
<?
sajax_show_javascript();
?>
function send() {
var name;
name = document.getElementById("name").value;
x_send(name);
}
</script>
</head>
<body>
<input type="text" name="name" id="name" value="Test" size="10">
<input type="button" name="check" value="Go"
onclick="send(); return false;">
</body>
</html>
It should just input the name in the DB, but now it only does a blank input..


Reply With Quote![[PHP]New to SAJAX](http://ragezone.com/hyper728.png)

