php - How can i use count function with autoincrement? -


i working on php situation have. should like. each product has unique id value. if product id posted throught submit button, count action should activited count number of time product id posted, increment.

i hope exposed situaation clearly. way thought doing it, can't work:

<?php  if (isset($_post['submit'])) {   $do = count($_post['id']);    echo $do;    if ($do > 1)  {    $i= $do+1;     echo $i;  } }   ?> <!doctype html>   <html>  <head>  <title>test</title>    </head>   <body>         <div class="holder">    <div class="im">   <img src="session-test/images/orange-juice.jpg" />    <p>bestorange-juice</p>   <form method="post" action="sessiontest.php">  <input type="hidden" id="id" name="id" value="2" />  <input type="hidden" id="price" name="price" value="25" />  <input type="submit" value="send value" name="submit" id="submit" />     </form>     </div>   <div class="im">   <img src="session-test/images/milkshake.jpg" />    <p>bestorange-juice</p> <form method="post" action="sessiontest.php">  <input type="hidden" id="id" name="id" value="3" />  <input type="hidden" id="prrice" name="price" value="1" />  <!--<input type="text" id="prodqty" name="prodqty" value="1" size="1"/>-->  <input type="submit" value="send value" name="submit" id="submit" />     </form>     </div> </div>     </body>     </html> 

if assume value in hidden input #id times users vote product:

if (isset($_post['submit'])) {  $do = count($_post['id']);   echo $do++; } 

if assume incorrectly don't understand want do, sincerly.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

html - Outlook 2010 Anchor (url/address/link) -