html - Creating post form with form name as holder -
how can create form form name container form posts.
this got:
array ( [sendername] => gsdfg [receiveraddress] => asdf [receiveremail] => asd@asd [xsize] => 2 [ysize] => 3 [zsize] => 4 [units] => cm [weight] => 22 )
but want is:
array ( [form] => array([sendername] => gsdfg [receiveraddress] => asdf [receiveremail] => asd@asd [xsize] => 2 [ysize] => 3 [zsize] => 4 [units] => cm [weight] => 22 ))
(giving form name attribute doesnt resolve problem)
this html:
<form action="http://dev.playgroundwp.lv/?page_id=24" id="productform" method="post"> <table> <tbody><tr> <td> <label for="sender-name-input">your name*:</label> </td> <td> <input type="text" name="sendername" value="" required="required" placeholder="enter name" id="sender-name-input"> </td> </tr> <tr> <td> <label for="receiver-address-input">receiver address*:</label> </td> <td><input type="text" name="receiveraddress" value="" required="required" placeholder="enter place" id="receiver-address-input"> </td> </tr> <tr> <td><label for="receiver-email-input">receiver email*:</label> </td> <td> <input type="email" name="receiveremail" value="" required="required" placeholder="enter email" id="receiver-email-input"> </td> </tr> <tr> <td><label for="x-size-input">size*:</label> </td> <td> <!-- type number nestrādās škiet uz ie < 9, jāskatās cik tālu nepieciešams supports --> <input type="number" placeholder="x" name="xsize" required="required" min="0" value="" step="0.01" id="x-size-input"> <input type="number" placeholder="y" name="ysize" required="required" min="0" value="" step="0.01" id="y-size-input"> <input type="number" placeholder="z" name="zsize" required="required" min="0" value="" step="0.01" id="z-size-input"> <select name="units" placeholder="select units" id="units-input"> <option value="mm">mm</option> <option value="cm">cm</option> <option value="m">m</option> </select> </td> </tr> <tr> <td> <label for="weight-input">weight*:</label> </td> <td> <input type="tel" placeholder="kg" name="weight" min="0" value="" step="0.01" required="required" id="weight-input"> </td> </tr> </tbody></table> <button type="submit" value="submitted">submit</button> </form>
how can achieve without using js?
there no connection between name of form (which should avoided in favour of id anyway) , data sends server.
if want php create associative array of values must give form controls names trigger that:
name="form[sendername]"
Comments
Post a Comment