[solved]for loop
Posted: Sun Jan 18, 2004 2:24 pm
i've got the following code in my script;
but, of course i don't work. the $_POST['entry_{$i}'] apparently doesn't work very well. but now on to the question;
Is it possible to do this somehow? Becuase i don't really want to have 10 extra lines doing it when i just could use a loop....
Code: Select all
<?php
for ($i = 1; $i <= 4; $i++) {
if (empty ($_POST['entry_{$i}']) || $_POST['entry_{$i}'] == 'http://') { $_POST['entry_{$i}'] = "empty"; }; //If entry is empty
$_POST['entry_{$i}'] = addslashes($_POST['entry_{$i}']); //Add slashes for security
}
?>Is it possible to do this somehow? Becuase i don't really want to have 10 extra lines doing it when i just could use a loop....