i want to hide a form until a button named storeip
is clicked and it deliver data from a input named ipstore
to a variable named $ipstore
.
users_log.php
$ipstore = $_POST['ipstore'];
$sql = "SELECT * FROM users_log WHERE u_id = 52 ORDER BY date_log";
$sql_query = mysql_query($sql);
$pager = new UL_Pagination($conn, $sql, 5, 5, "param1=valu1¶m2=value2");
/*
* Enable debugging if you want o view query errors
*/
$pager->setDebug(true);
$rs = $pager->paginate();
if(!$rs) die(mysql_error());
if(mysql_num_rows($sql_query) > 0)
{
$sorting = array();
while($row = mysql_fetch_assoc($rs))
{
$sorting[$row['logged_date']][] = "<h4 class='bdr-rit' id='c-code'>".$row['c_code']."</h4>"."<h4 class='bdr-rit'><button type='submit' name='storeip'><input type='hidden' name='ipstore' value='".$row['logged_ip']."'/>".$row['logged_ip']."</button></h4>"."<h4 class='bdr-rit'>".$row['login_time']."</h4>"."<h4>".$row['logout_time']."</h4>";
}
echo "<form action='' method='post' enctype='multipart/form-data'>";
echo "<ul>";
echo " <li class='ul-hd'>
<h4 class='ul-one'>code</h4>
<h4 class='ul-two'>ip</h4>
<h4 class='ul-thr'>login</h4>
<h4 class='ul-for'>logout</h4>
</li> ";
foreach($sorting as $key => $value)
{
echo "<li>".$key."<li>";
foreach ($value as $data)
{
echo "<li>".$data."</li>";
}
}
echo "</ul>";
echo "<form>";
i am using users_log
to display users login and logged information with ip and country code and a button named storeip
will deliver the ip
address to next hidden form
, which is clicked.
home.php
// include pagination class
include('include/ul_pagination.php');
// db connection
include('c-db.php');
if ( isset( $_POST["storeip"] ) and !empty($ipstore) )
{
echo "<form action='' method='post' enctype='multipart/form-data'>";
echo "<ul>";
echo " <li class='ul-hd'>
<h4 class='ul-one'>ip</h4>
<h4 class='ul-fiv'>".$ipstore."</h4>
</li>
<li class='ul-hd'>
<h4 class='ul-one'>code</h4>
<h4 class='ul-two'>country</h4>
<h4 class='ul-thr'>city</h4>
<h4 class='ul-for'>flag</h4>
</li> ";
echo "</ul>";
echo "<form>";
}
else
{
include('include/users_log.php');
}
mysql_close($conn);
above code is to display the users_log
page until users do not require to see the hidden form. hidden form is contain details of ip
, thats why i need to derived the ip
address from users_log
to hidden form to display details about the ip
. when i add print_r($_POST)
to the top of the users_log
page, after that, when i click on the ip
address button then it shows Array ( [storeip] => [ipstore] => 127.0.0.1 )
, but still failed to figure out where i am doing the wrong thing. help me or suggest your great ideas, every suggestion will be appreciated and advance thanks to all.