Chubbymouse 0 Newbie Poster

Hi there,
I have a very basic CMS system that I wish to update within itself and on the same page to cut down the amount of pages it gives me.

At present I have a content box and an edit button, this box is validated by JS and if return true then the database updates, however after the database updates I want to redirect the user back to the main edit pages.

I have tried numerous attempts to redirect but none seem to work, I'm not sure what is causing it to stop.

Any help much appreciated.

<script type="text/javascript">
	function valText(){
	
		var text = document.getElementById('tag');
		var div = document.getElementById('errormsg');
		
		var lets = /^[0-9a-zA-Z\s\-\'(\)\&\,\:\.\!\?]+$/;
		
		if((text.value == '') || (text.value == ' ')){
			div.innerHTML="<b>Please enter your changes</b>";
			text.focus();
			return false;}
		else if(text.value.match(lets)){
			div.innerHTML="<b>Content updated</b>";
			return true;}
	else {
		return false;}
			
	}
</script>
<script type="text/javascript" language="javascript">
    function redirect()
    {
        location.href = "edhome.php";
    }
</script>
<div id = "errormsg">&nbsp;</div>
    <?php 
	
	echo "<table border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"7\" style=\"font-family:Arial;font-size:11px\">";
	echo "<tr>";
		echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "</tr>";
echo "<tr>";
		echo "<td><form name=\"confhome\" method=\"post\" action=\"\" onsubmit=\"return valText()\"><textarea name=\"tag\" cols=\"20\" rows=\"3\" id=\"tag\">$row[tagbrief]</textarea></td></tr>";
		echo "<tr><td><input type=\"submit\" value=\"Edit\" onclick=\"redirect()\"></form></td></tr>";
		echo "<tr></tr>";
		echo "</table><br/>";
 
	$tagbrief = $_POST['tag'];
	mysql_query("UPDATE quackedup SET tagbrief='$tagbrief' WHERE id='1'");
	?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.