Hey, I'm very new to the prototype framework, but have managed to get the insert part of my code working, but I want to insert and then update, without a page refresh. Here's what I have so far:

Code:
<script type="text/javascript">
function sendRequest() {
	new Ajax.Request("appointments.php", 
		{ 
		method: 'post', 
		postBody: 'name='+ $F('name')+ '&date='+ $F('date')+ '&time='+ $F('time')+ '&where='+ $F('where')+ '&phone_no='+ $F('phone_no')+ '&job_desc='+ $F('job_desc')+ '&quoted_price='+ $F('quoted_price'),
		onComplete: showResponse 
		});
	}

function showResponse(req){
	$('response').innerHTML= req.responseText;
	}
</script>
PHP Code:
<?php 
require("includes/connection.php");
date_default_timezone_set("Europe/London");
$datenow date("Y-m-d");

/*
Adds new appointment and returns successful if appointment added
Returns false if any of the fields are empty
*/

$fields = array('name','date','time','where','phone_no','job_desc','quoted_price');

foreach(
$fields as $field)
{
    if(empty(
$_POST[$field]))
    {
    die(
'You need to complete all fields.');
    }
    else
    {
    $
$field mysql_real_escape_string($_POST[$field]); // Variable within a variable, sanitize variable
    
}
}

$query "INSERT INTO appointments (`name`, `date`, `time`, `where`, `phone_no`, `job_description`, `quoted_price`) 
                    VALUES('
$name', '$date', '$time', '$where', '$phone_no', '$job_desc', '$quoted_price')";

if(!
mysql_query($query))
{
    die(
"Failed to create" mysql_error());
}
else
{
    echo 
"Appointment created!";
}
                    
mysql_close($con);

?>
I tried using:

Code:
function UpdatePage()
{
new Ajax.Updater('apptable','updateapp.php', { method: 'get', insertion: Insertion.Bottom });
}
But I was just fiddling with it, not really knowing what I was doing. Anyone got any suggestions?