HTML form data to JSON(php) -


i passing data mobile via api server.for have made html form,which has combination of text boxes,labels, select boxes, etc.now on button click want convert form data json format.what possible way it.

like example,

<label for="register_email">email:</label> <input type="text" name="email" id="register_email" /> <label for="register_password">password:</label> <input type="password" name="password" id="register_password" /> <label for="register_password_confirmation">password confirmation:</label> <input type="password" name="register_password_confirmation" id="register_password_confirmation" /> <input type="submit" value="register" /> 

so when user enters data,after click form data should converted json format.

in other page...

<?php if(isset($_post)) {     foreach($_post $k=>$v)     {         $params[$k]=$v;     }      echo json_encode($params); } 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -