php - null values on $_post -
i'm trying create basic input form record new clients mariadb table post results coming null.
the form entry set below
<form class="clientreg" id="newclient" method="post" action="posttest.php"> <label>client name: <input type="text" name="clientname" class="longtext"/> </label> <label>bulk discount: <input type="number" name="bulk" class="discount"/></label> <label>settlement discount: <input type="number" name="settlement" class="discount"/></label> <label>trades discount: <input type="number" name="trades" class="discount"/></label> <input type="submit"/> </form>
print_r($_post)
returns array()
information not being picked on submission. i've checked obvious issues come ie no name=' attributes
, correct encasing, i'm @ complete loss
i think have problem php script posttest.php. form seems ok.
html
<!doctype html> <html lang="en" class="no-js"> <head> <title>just test</title> </head> <div id="response" ></div> <h3>login</h3> <form class="clientreg" id="newclient" method="post" action="posttest.php"> <label>client name: <input type="text" name="clientname" class="longtext"/> </label> <label>bulk discount: <input type="number" name="bulk" class="discount"/></label> <label>settlement discount: <input type="number" name="settlement" class="discount"/></label> <label>trades discount: <input type="number" name="trades" class="discount"/></label> <input type="submit"/> </form> </div> </body> </html>
posttest.php
<?php echo '<pre>'; print_r($_post); echo '</pre>'; foreach($_post $key=>$val) { echo "\$_post[$key]=$val<br />"; } ?>
result
array ( [clientname] => myname [bulk] => 1 [settlement] => 2 [trades] => 3 ) $_post[clientname]=myname $_post[bulk]=1 $_post[settlement]=2 $_post[trades]=3
Comments
Post a Comment