Hi,

I insert into database with Submit button in same page. After clicking submit, i want whole page to be refreshed. How can i do it? Code is below and where can i add something to refresh after insert.

Thanks

<form name="form1" method="post" action="">
.....
<input type="submit" name="Submit" value="Add" onClick="javascript: form.action='insert.php';">
</form>
<?php
if ($_POST["Submit"] == "Add") {
....inserting data in here
}
?>

Recommended Answers

You are going to have to stick this part:

<?php
if ($_POST["Submit"] == "Add") {
....inserting data in here
}
?>

at the top so that you don't leave any white space before the opening <?php tag. Then after your mysql_query use a the header() function.

header("location: " . $_SERVER['REQUEST_URI']);
Jump to Post

All 2 Replies

You are going to have to stick this part:

<?php
if ($_POST["Submit"] == "Add") {
....inserting data in here
}
?>

at the top so that you don't leave any white space before the opening <?php tag. Then after your mysql_query use a the header() function.

header("location: " . $_SERVER['REQUEST_URI']);

hi friends,

I just wanna know how can we add a reply option on every comment in php.
please help us

Be a part of the DaniWeb community

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