html - hidden field in php -


for hidden fields, can use field of type

<input type="hidden" name="field_name" value="<?php print $var; ?>"/> 

and retrieve after / post method $_get['field_name'] / $_post['field_name'] ?

are there other ways of using hidden fields in php?

you absolutely can, use approach lot w/ both javascript , php.

field definition:

<input type="hidden" name="foo" value="<?php echo $var;?>" /> 

access w/ php:

$_get['foo'] or $_post['foo'] 

also: don't forget sanitize inputs if going database. feel free use routine: https://github.com/niczak/php-sanitize-post/blob/master/sanitize.php

cheers!


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -