html - How to generate auto redirect of php page that takes one input variable to same page php with another input variable? -
so have set of values let's 90, 100, 110, 120, 130, 140, 150 first time load php page, value 90 main input variable , page displays details 90. in 60 seconds page redirects same page input variable 100. continues on , when 150-related stuff displayed, goes 90-related stuff. how can achieved??
<?php mysql_connect("localhost", "root", "qwerty") or die(mysql_error()); mysql_select_db("ups_status") or die(mysql_error()); $data = $_post['input'] ;// <!--this input should change after every redirect--> $order = "select * ups_status1 (ipaddress '%".$data."%')"; $results = mysql_query($order) or die('invalid query: ' .mysql_error()); // <!--and echo results--> ?>
<?php session_start(); if (!isset($_session['counter'])) { $_session['counter'] = array(90, 100, 110, 120, 130, 140, 150); } $i = isset($_session['i']) ? $_session['i'] : 0; echo "variable ".$_session['counter'][$i]; /* put code here*/ mysql_connect("localhost", "root", "qwerty") or die(mysql_error()); mysql_select_db("ups_status") or die(mysql_error()); $data = $_session['counter'][$i] ;// <!--this input should change after every redirect--> $order = "select * ups_status1 (ipaddress '%".$data."%')"; $results = mysql_query($order) or die('invalid query: ' .mysql_error()); /*********************/ if ( $i == count($_session['counter']) - 1) { $next = 0; } else { $next = $i + 1; } $_session['i'] = $next; header( "refresh:5;url=refresh.php" ); echo '<br>you\'ll redirected in 5 secs. if not, click <a href="refresh.php">here</a>.'; ?>
Comments
Post a Comment