html - Get the Value from another PHP page -
hello have below form in page viewsensordata.php
... $refresh = ($_post['refresh']); $link_address="viewsensordata.php?view=".$view; ?> <form method="post" action="<?php echo $link_address;?>"> <select id="refresh" name="refresh"> <option value="-">select seconds</option> <option value="1">1 second</option> <option value="2">2 seconds</option> <option value="3">3 seconds</option> <option value="4">4 seconds</option> <option value="5">5 seconds</option> <option value="10">10 seconds</option> <option value="15">15 seconds</option> <option value="30">30 seconds</option> <option value="60">60 seconds</option> </select> <input type="submit" value="refresh" name="refresh_rate"/> </form> <meta http-equiv="refresh" content="<?php echo $refresh;?>;url=refreshsensordata.php"> <br />
and want value of $refresh
page named viewsensordata2.php
in viewsensordata2.php
have $refresh = ($_get['refresh']);
in order other page doesnt work. how can fix that?
<?php $link_address="viewsensordata.php?view=".$view; ?> <form method="post" action="<?php echo $link_address;?>"> <select id="refresh" name="refresh"> <option value="-">select seconds</option> <option value="1">1 second</option> <option value="2">2 seconds</option> <option value="3">3 seconds</option> <option value="4">4 seconds</option> <option value="5">5 seconds</option> <option value="10">10 seconds</option> <option value="15">15 seconds</option> <option value="30">30 seconds</option> <option value="60">60 seconds</option> </select> <input type="submit" value="refresh" name="refresh_rate"/> </form>
then in second page, can refresh this:
<?php if(isset($_post) && isset($_post['refresh'])){ $sec = $_post['refresh']; } elseif(isset($_get) && isset($_get['seconds'])){ $sec = $_get['seconds']; } else{ $sec = 10; // defualt seconds, if not set form or url } ?> <meta http-equiv="refresh" content="<?php echo $sec ;?> url=<?php echo $_server['php_self']; ?>?seconds=$sec">
Comments
Post a Comment