HTML & PHP
Posted by: Jan (---.sympatico.ca)
Date: July 22, 2006 07:00AM

Hi,

I have a separate HTML file that has FORM and when Submit button is clicked on, it calls in the PHP (which is also a separated file) to Insert the data into database. My problem is once data are inserted, I have to click on Back on the browser to go back to the HTML file, where the Form is, and if I accidentally click on Refresh button while still on the (//localhost/blabla.php) page, it will automatically insert the last data I put in. Is there a way to make it go back to HTML file once Submit button is clicked? Should I call in the HTML file in the PHP script - if so, how?

Thank you

Options: ReplyQuote
Re: HTML & PHP
Posted by: CyberSpatium (67.170.181.---)
Date: July 22, 2006 05:36PM

you can either use some kind AJAX form script since AJAX does not have to be refreshed, or you can use sessions

[us3.php.net]

Options: ReplyQuote
Re: HTML & PHP
Posted by: mongtay (---)
Date: July 24, 2006 06:13AM

Uhm, Ajax is a good once, but you can also go back by writing some JavaScript code in your PHP file (after inserted your data), like this:

if ($result = mysql_query($sql, $conn))
{
print "<script language=\"javascript\">
document.location = \"main.htm\";
</script>";
}
else
{
//Anything you want...
}


Hope this help!

Options: ReplyQuote
Re: HTML & PHP
Posted by: Jan (---.sympatico.ca)
Date: July 25, 2006 03:57AM

Hi,
Thank you for your time however I am getting the following error:

Parse error: syntax error, unexpected '{' in C:\wamp\www\insert_contact2b.php on line 25

Why is it saying .PHP on line 25 though I specifically put my .HTM file on that line ?

Please help


Thanks

Options: ReplyQuote
Re: HTML & PHP
Posted by: mongtay (---)
Date: July 25, 2006 09:01AM

I swear that i don't know anything which you're talking about grinning smiley Can you post your code here (insert_contact2b.php) or just a line 25.

Btw, you're welcome smiling smiley

Options: ReplyQuote


Sorry, only registered users may post in this forum.