Can Someone Tell Me how to make a auto posting form .
I need theat form for automatic pots ip on sql db,
Please Help Thx.

I think we'd need more information on just what it is you're trying to do, and clarification on your second sentence, in order to help.

Can Someone Tell Me how to make a auto posting form .
I need theat form for automatic pots ip on sql db,
Please Help Thx.

Error file

<?php 
$ip = getenv("REMOTE_ADDR") ;
print_r($_POST['ip']);
?>
<form name="form1" method="post" action="ip ban.php">
<input type="submit" name="ip" id="ip" value="<?php echo $ip ;?>">
</form>

Post File

<?php 
include "sec/db.php";
if (isset($_POST['ip'])) {$ip = $_POST['ip']; if ($ip == ''){unset($ip);}}
?>
<?php
if (
isset($ip)
)
{
$date = date("Y-m-d-H-m-s");
$result = mysql_query ("INSERT INTO ip (ip,date) VALUES ('$ip','$date')");}
?>
<?php
$url="index.php";
$timeout_minutes = 0;
$timeout_seconds = 1;
sleep($timeout_seconds + $timeout_minutes * 60);
exit;
?>

And i need theat te $ip to be posted automaticli (sry Bad englesh)

Do you even need a form? It looks like you're just wanting log the ip address of the visitor.

Is there any reason not to just go ahead and run the query to insert it?

If that's all you're trying to do, it could be done in just a couple of lines of code, and the date could be formatted right in the sql query rather than in PHP.

Let me know and if that's it I can help.

Yes this is what I wanted to do

I think this is what you want:

mysql_query ("INSERT INTO ip (ip,date) VALUES ('".$_SERVER["REMOTE_ADDR"]."',NOW()") or die(mysql_error());

Search Google on "mysql now()" for further information if you what to modify the date format used.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.