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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.