2015-11-22 20:54 阅读 8


code is working properly. When it times to press the submit button it didn't give any answer or error. I'd also tried to change the form< action="..." > and place the result in another file but it didn't show anything.

<form action= "" methods="post">
<!-- image section start from here -->
  <div class="desc"> E-LN3465 <br/> PRICE: 5000 Pkr <br/><input type="text" name="E-LN3465"  value="1" /> </div>

  <div class="desc">E-LN7645 <br/> PRICE: 4000 Pkr <br/><input type="text" name="E-LN7645"  value="1" /></div>

 <div class="desc">E-LN7644 <br/> PRICE: 5000 Pkr<br/><input type="text" name="E-LN7644"  value="1" /></div>

  <div class="desc">E-LN3456 <br/> PRICE: 8000 Pkr <br/><input type="text" name="E-LN3456"  value="1" /> </div>

  <div class="desc">E-LN7863 <br/> PRICE: 4900 Pkr <br/><input type="text" name="E-LN7863"  value="1" /></div>

  <div class="desc">E-LN6709 <br/> PRICE: 5000 Pkr<br/><input type="text" name="E-LN6709"  value="1" /> </div>

                <p><input type="submit"  name=" submit" value="Add to cart" /></p>
            { echo $_POST['E-LN6709'];  }

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dongtao4319 dongtao4319 2015-11-22 21:07

    N.B.: Making this as a community wiki. I feel there should be no personal gain from this answer.

    As outlined in comments:

    • Use method="post" (without the s in method). – D4V1D

    • also, <input type="text" name="E-LN6709" value="1" / needs a > on the end – Adam

    But this one I caught after:

    name=" submit"

    Your conditional statement will fail because of the space in there.

    • Remove it name="submit"

    Add error reporting to the top of your file(s) which will help find errors.

    ini_set('display_errors', 1);
    // rest of your code

    Sidenote: Displaying errors should only be done in staging, and never production.

    点赞 评论 复制链接分享