aggrav8d Posted August 21, 2009 Share Posted August 21, 2009 http://polycase.reverb-marketing.com/dc-34f.php when I click the "add to cart" button on the top left of the page it should jump down to the order form on the bottom right. it jumps down and then (unexpectedly) jumps back to the top of the page. What did I do wrong? Quote Link to comment Share on other sites More sharing options...
lostprophetpunk Posted August 21, 2009 Share Posted August 21, 2009 It's mainly because you are telling it to go the same place again as you have #order_form at the 'add to cart' button. Where it says this... <td colspan='2'>Please select from the following list of options:</td> Make it like... <td colspan='2'><a href='#order_form'></a>Please select from the following list of options:</td> Change the image code to... <input type='image' name='cart' src='addtocart.png' /> Then put somewhere on the page... if($isset($_POST['cart']){ header('Location: http://polycase.reverb-marketing.com/dc-34f.php#order_form' ); } Quote Link to comment Share on other sites More sharing options...
aggrav8d Posted August 25, 2009 Author Share Posted August 25, 2009 How is that going to help? It's totally screwing up the intent of the buttons. The TOP add to cart should cause a jump to the BOTTOM add to cart. There shouldn't be any need for the top one to submit a form and go through PHP and a redirect. Quote Link to comment Share on other sites More sharing options...
lostprophetpunk Posted August 26, 2009 Share Posted August 26, 2009 How is that going to help? It's totally screwing up the intent of the buttons. The TOP add to cart should cause a jump to the BOTTOM add to cart. There shouldn't be any need for the top one to submit a form and go through PHP and a redirect. Sorry, I went about it the wrong way. Keep the cart image button with the '#order_form' link, but put just underneath the second (bottom) 'add to cart' image button this... <a name='order_form'></a> Sorry man, I wasn't thinking straight. Quote Link to comment Share on other sites More sharing options...
aggrav8d Posted August 27, 2009 Author Share Posted August 27, 2009 It was there the first time I posted the question. <div class='belly_item belly_item_wide add_to_cart'> <div class='top'> <div class='bottom'> <div class='belly_content tall'> <a name='order_form'></a> <form action='' method='post'> <table class='order_options'> <thead> <tr><td colspan='2'>Please select from the following list of options:</td></tr> </thead> <tbody> Any idea why the browser jumps back to the top of the page when I click the "add to cart" button at the top of the page? It should jump to the bottom and STAY THERE. Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted August 27, 2009 Share Posted August 27, 2009 The "add to cart" link should ONLY be a <a>. An input tag will screw things up. The browser thinks the form selfs submits so it will jump back up. Next, to make a link move the page's position you need to use an id. So this is your code: <a href="#cart_form">Add to Cart</a> .... down the page <div id="cart_form"> ... cart form </div> Quote Link to comment Share on other sites More sharing options...
sawade Posted August 27, 2009 Share Posted August 27, 2009 You have: <a href='dc-34f.php#order_form'> Try: <a href='#order_form'> Why: You don't need the page name since you are in the page. Hope that helps. Quote Link to comment Share on other sites More sharing options...
aggrav8d Posted August 28, 2009 Author Share Posted August 28, 2009 sawade, I had it both ways at various times. Neither has worked. TheFilmGod, the order_form link/achor pair has nothing to do with the input at the bottom that submits the form. id tags have nothing to do with link/achor pairs. Please don't drink and post. Quote Link to comment Share on other sites More sharing options...
kraig Posted August 28, 2009 Share Posted August 28, 2009 Nice thread guys. It was very useful for me. It will be useful for Html beginners also. ----------- photography blog Quote Link to comment Share on other sites More sharing options...
sawade Posted August 28, 2009 Share Posted August 28, 2009 sawade, I had it both ways at various times. Neither has worked. TheFilmGod, the order_form link/achor pair has nothing to do with the input at the bottom that submits the form. id tags have nothing to do with link/achor pairs. Please don't drink and post. Hmmm. Okay. So I decided to see if your code is validating... add well it's not. You have 122 errors in your code. These errors could be why it's not working for you. I will add in the URL which I am hoping will retain your code and it's results. http://validator.w3.org/check If it doesn't. Just copy and paste your code into the validator and it will show you the results again. Also, I am not positive so double check in your free time. But I believe XHTML only allows for double quotes. IE = <a href='textsample.php'>Site map</a> would be <a href="textsample.php">Site map</a> Quote Link to comment 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.