HTML form post method and auto-refreshing PHP page -


in html page, have php iframe gets variables form using post method. works fine.

my problem this: php iframe auto-refresh (which does), , understandably, undefined index errors php first time iframe auto-refreshes.

is there way (preferably using php/html) allow iframe hold on variables html form after first load of php iframe? isset doesn't seem answer problem

here's simple way of accomplishing you're after:

<?php  // starts session session_start();  // gets variable via $_post if present , caches in $_session // if doesn't exist in $_post or $_session, return null function get_variable( $name ) {     if( isset( $_post[$name] ) )     {         $_session['cache_'.$name] = $_post[$name];     }     return ( isset( $_session['cache_'.$name] ) ? $_session['cache_'.$name] : null ); }  // these values form on cache $value_a = get_variable('field_name_a'); $value_b = get_variable('field_name_b'); $value_c = get_variable('field_name_c');  // 1 values missing if( is_null( $value_a ) || is_null( $value_b ) || is_null( $value_c ) ) {     // display error message or whatever else } // values present else {     // use variables before }  ?> 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -