<?php
if(isset($_POST['merchantname']) && isset($_POST['firstname'])) {
$data = "Merchant" . "," .$_POST['merchantname'] . "," . $_POST['firstname'] . ","
.$_POST['surname'] . "," . $_POST['regnumber'] . ","
.$_POST['bankname'] . "," . $_POST['branchcode'] . ","
.$_POST['accnumber'] . "," . $_POST['acctype'] . ","
.$_POST['email'] . "," . $_POST['mobilenumber'] . "\n";
//.$_POST['field11'] . "\n" . $_POST['field12'] . "\n"
//. $_POST['field13'] . "\n" . $_POST['field14'] . "\n";
//$count = 0
$number = 0;
while ($number >=0 ) {
echo str_pad ($number, 2, '0', STR_PAD_LEFT), '<br>';
$number = $number ; // or any rule you want.
}
$filename = "files/" .'Epays' . '_' . $_POST['merchantname'].'_' . date('Ymd').'_' . date('His').'_' . $number .".txt";
if (!file_exists($filename)) {
$fh = fopen($filename, 'w') or die("Can't create file");
}
$ret = file_put_contents($filename, $data, FILE_APPEND | LOCK_EX);
if($ret === false) {
die('There was an error writing this file');
}
else {
echo '<script type="text/javascript">
message1();
</script>';
}
}
else {
die('no post data to process');
}
?>
CodePudding user response: