Notice: Undefined index: txtQuant - PHP Textbox is undefined using SESSIONS -


notice: undefined index: txtquant in e:\wamp\www\shoppingcartv4\cartv4.php on line 8

notice: undefined index: txtquant in e:\wamp\www\shoppingcartv4\cartv4.php on line 56

my update code:

 if(isset($_get["update"]))     {     $i = $_get["update"];       $_session["qnty"] = $_get["txtquant"];     $_session["amounts"][$i] = $_session["qnty"][$i];      } 

my html code

<?php        if(!empty($_session["products"])){           ($i=0; $i< count($_session["products"]); $i++) {            ?>            <tr>            <td><?php echo($_session["products"][$i]); ?></td>            <td width="10px">&nbsp;</td>            <td><input type="text" name="txtquant[]"></td>            <td width="10px">&nbsp;</td>            <td><?php echo($_session["amounts"][$i]); ?></td>            <td width="10px">&nbsp;</td>              <td><a href="?update=<?php echo($i); ?>">update</a></td>             </tr>            <?php          }        }          ?> 

how can resolved problem? thank you

do have form wrapped in form tag? should wrapping html code there tag. otherwise there no form submit , thing in $_get array update.

session_start() going initialize session, nothing in code see adds txtquant session. if doing is, clicks "update" link , submits update code snippet have won't work. need wrap table on bottom there in form:

<?php        if(!empty($_session["products"])){ ?>  <form> <?php           ($i=0; $i< count($_session["products"]); $i++) {            ?>            <tr>            <td><?php echo($_session["products"][$i]); ?></td>            <td width="10px">&nbsp;</td>            <td><input type="text" name="txtquant[]"></td>            <td width="10px">&nbsp;</td>            <td><?php echo($_session["amounts"][$i]); ?></td>            <td width="10px">&nbsp;</td>             <td><input type="submit" value="update"></td>            <td><input type="hidden" name="update" value="<?php echo($i); ?>" /></td>            </tr>            <?php          }          ?> </form>        <?php        }          ?> 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -