Note that there are some explanatory texts on larger screens.

plurals
  1. POredirect a page after button click and database update
    text
    copied!<p>I am trying to get a page to redirect after I click the button and after the database updates but it doesnt seem to work.</p> <p>I have a form that completes in itself, to cut down on the number of pages used (e.g no, thanks content has been edited" page) but after the content has been edited i wish to redirect back home.</p> <p>form and database update:</p> <pre><code> &lt;div id = "errormsg"&gt;&amp;nbsp;&lt;/div&gt; &lt;?php echo "&lt;table border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"7\" style=\"font-family:Arial;font-size:11px\"&gt;"; echo "&lt;tr&gt;"; echo "&lt;td&gt;&amp;nbsp;&lt;/td&gt;"; echo "&lt;td&gt;&amp;nbsp;&lt;/td&gt;"; echo "&lt;/tr&gt;"; echo "&lt;tr&gt;"; echo "&lt;td&gt;&lt;form name=\"confhome\" method=\"post\" action=\"\" onsubmit=\"return valText()\"&gt;&lt;textarea name=\"tag\" cols=\"20\" rows=\"3\" id=\"tag\"&gt;$row[tagbrief]&lt;/textarea&gt;&lt;/td&gt;&lt;/tr&gt;"; echo "&lt;tr&gt;&lt;td&gt;&lt;input type=\"submit\" value=\"Edit\"&gt;&lt;/form&gt;&lt;/td&gt;&lt;/tr&gt;"; echo "&lt;tr&gt;&lt;/tr&gt;"; echo "&lt;/table&gt;&lt;br/&gt;"; $tagbrief = $_POST['tag']; mysql_query("UPDATE quackedup SET tagbrief='$tagbrief' WHERE id='1'"); ?&gt; </code></pre> <p>JS validation for ref</p> <pre><code>&lt;script type="text/javascript"&gt; function valText(){ var text = document.getElementById('tag'); var div = document.getElementById('errormsg'); var lets = /^[0-9a-zA-Z\s\-\'(\)\&amp;\,\:\.\!\?]+$/; if((text.value == '') || (text.value == ' ')){ div.innerHTML="&lt;b&gt;Please enter your changes&lt;/b&gt;"; text.focus(); return false;} else if(text.value.match(lets)){ div.innerHTML="&lt;b&gt;Content updated&lt;/b&gt;"; return true;} else { return false;} } </code></pre> <p></p> <p>Any help appreciated, thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload