How to use $_POST in better way.
Suppose there are 10 fields in a PHP webpage that's data are saving into database.
In that 10 fields 2 fields are empty and when in values are empty you want store "N/A" values are saving into database.
Use below one line of code:
$myval = isset( $_POST['myvar'] ) ? $_POST['myvar'] : 'N/A';
You can use this logic in any website programming language.
In that 10 fields 2 fields are empty and when in values are empty you want store "N/A" values are saving into database.
Use below one line of code:
$myval = isset( $_POST['myvar'] ) ? $_POST['myvar'] : 'N/A';
You can use this logic in any website programming language.
0 comments:
Post a Comment