Jump to content

[SOLVED] Alerts :-*


ali_2kool2002

Recommended Posts

Hey guys,,,

 

im using java script in php. The problem is i have a form which has a submit button it transfers to the handling form script page but i want to keep it on the same page?

 

is it anything to do with this line ?

<form name="myForm" action="addtocart.php" method="post">

 

and if i do keep on the same page would that mean i would need to transfer the handling code in my file named "addtocart.php" to the 1st page?

Link to comment
https://forums.phpfreaks.com/topic/39334-solved-alerts/
Share on other sites

Yes. If you want everything done on one page, you would put all your code on one page and add a check to see if the form has been submitted.

 

<?php
if(isset($_POST['submit'])){
// Code to process your form below


} else {
// code to show your form below
echo "<form name=\"myForm\" action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">";


}
?>

 

Ray

Link to comment
https://forums.phpfreaks.com/topic/39334-solved-alerts/#findComment-189686
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.