KevinM1 Posted December 13, 2006 Share Posted December 13, 2006 ...but I'm not 100% sure how to implement it the way I want it to be implemented. I'm writing scripts for my work's e-commerce side of things, and would like it if I could notify the user that their item has been added once they click "Add item to cart" (which will be a form submission button). I'm just not sure how to do it with a sticky form.I know how to make a generic sticky form -- check if the form's been submitted, and react accordingly. I'm just concerned about the post-submit behavior. Would something like the following work:[code]<?phpif(isset($_POST['submit'])){ echo "$_POST['quantity'] of $_POST['name'] has been added to your cart!";...}?><form...>...[/code]If so, how would the end result be displayed? Would the form not appear because it has been submitted, or would the order confirmation bit be displayed with the form? Quote Link to comment https://forums.phpfreaks.com/topic/30528-i-think-i-want-a-sticky-form/ Share on other sites More sharing options...
TEENFRONT Posted December 13, 2006 Share Posted December 13, 2006 [code]<?if(isset($_POST['submit'])){ // this sees if the form is submitted if it has, then the echo shows the text about something has been added to the cart etc echo ".... has been added to your cart etc"; } else { // This means if the form has NOT been submittedecho "<form> .... </form>"; } [/code]So the first bit shows the added to cart text if the form has been submitted, then the second bit only shows the form , if the form has not been submitted. You will probly want to check other strings aswell before actually telling the user that the item has been added, like to see if an item id was submitted correctly etc. } Quote Link to comment https://forums.phpfreaks.com/topic/30528-i-think-i-want-a-sticky-form/#findComment-140543 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.