无法识别的变量

时间:2015-12-06 14:11:36

标签: php html

我彻底研究了这个主题,但作为编程的初学者,我希望PHP将数据从HTML表单写入文件。但经过一系列的尝试,我仍然得到一个错误。有人可以通过查看代码来帮助吗?

以下是代码:

    <form action="oneaccountrecord.php">
<p>Transaction type</p>
<select name='transtype'>
<option name="revenue" value="revenue">Revenue</option>
<option name="expense" value="expense">Expense</option>
</select>
<br>
<p>Date</p>
<input name="date" value="date" type="date" data-date-inline-picker="true"  />
<br>
<p>Description</p>
<input name="description"  type="text"   />
<br>
<p>Amount</p>
<input name="amount"  type="number"   />
<input type="submit" value="Proknjizi">
</form>

Here is the php script:

    <?php



    // Deklaracija  varijabli
    $date = $_POST['date'];
    $description = $_POST['description'];
    $amount = $_POST['amount'];


$file = 'account.txt';

$stampa = $date . $description . $amount .PHP_EOL;

// Write the contents to the file, 
// using the FILE_APPEND flag to append the content to the end of the file
// and the LOCK_EX flag to prevent anyone else writing to the file at the same time
file_put_contents($file, $stampa, FILE_APPEND | LOCK_EX);


// Odštampaj dan, datum, mjesec, godinu, vrijeme, AM ili PM
echo date("l jS \of F Y h:i:s A" );
// Štampa da je proknjizio
print "</br>";
print "Zabiljezio sam transakciju.";
print "</br>";

// Kraj 


?>

0 个答案:

没有答案