Hello i am working about a articles script
i have a small problem in new post page ( new_post.php )
my form page
<form>
input name = "post_title"
textarea = "post_content"
</form>
in my proccess page i have ( php if statment )
example
if(empty($_POST['post_title]){
$_SESSION['error'] = 'Titl开发者_如何学Pythone field is empty !';
header("location: newpost.php");
}
it's working fine
but the problem is
i lost the post data if the system redirected me !
sorry for my language but i mean
the data i have writed in the text area of the post content is lost if the system redirected me to the new post page !
so , how i can keep this data without lost after redirecting ?
Save the post data to a $_SESSION variable (or array) before redirecting. That way, you can recall it later.
You could avoid redirecting by using a php function to display your form. That way you could simply pass the values as arguments to the function.
function showForm($title="", $content=""){
{display form using the arguments as values for each form field}
}
精彩评论