It doesn't really matter as you ought to do HTTP redirect after POST request anyway.
However, most common practice is to send to the same URL, as it's described in /POST/Redirect/GET pattern
a concise example:
<?
if ($_SERVER['REQUEST_METHOD']=='POST') {
$err = array();
//performing all validations and raising corresponding errors
if (empty($_POST['name']) $err[] = "Username field is required";
if (empty($_POST['text']) $err[] = "Comments field is required";
if (!$err) {
//if no errors - saving data
// ...
// and then redirect:
header("Location: ".$_SERVER['PHP_SELF']);
exit;
} else {
// all field values should be escaped according to HTML standard
foreach ($_POST as $key => $val) {
$form[$key] = htmlspecialchars($val);
}
} else {
$form['name'] = $form['comments'] = '';
}
$tpl = 'form.tpl.php';
include 'main.tpl.php';
?>
where form.tpl.php
is a template contains HTML form with PHP code to display form values out of the $form
array
<? foreach ($err as $line): ?>
<div style="error"><?=$line?></div>
<? endforeach ?>
<form method="POST">
<input type="text" name="name" value="<?=$form['name']?>"><br>
<textarea name="comments"><?=$form['comments']?></textarea><br>
<input type="submit"><br>
</form>
and main.tpl.php
is a main site template as it's described here: Using Template on PHP