1
我只是試圖在數據庫中插入一些變量。連接工作,但我不斷收到查詢錯誤。插入數據庫時發生查詢錯誤
這裏的HTML:
<form action="process-step1.php" method="post">
<div id="fromDiv" class="clearfix">
<h4>Your Name</h4>
<input type="text" name="from" id="from" value="" />
<h4>Your E-mail</h4>
<input type="text" name="fromemail" id="fromemail" value="" />
</div>
<div id="toDiv" class="clearfix">
<h4>Recipient Name</h4>
<input type="text" name="to" id="to" value="" />
<h4>Recipient E-mail</h4>
<input type="text" name="toemail" id="toemail" value="" />
</div>
<div id="messageDiv" class="clearfix">
<h4>Message</h4>
<textarea name="message" id="message"></textarea>
</div>
<div id="submitDiv" class="clearfix">
<input type="submit" value="Preview my Card" name="submit" id="submit" />
</div>
</form>
這裏是PHP程序:
$from = mysql_escape_string($_POST['from']);
$fromemail = mysql_escape_string($_POST['fromemail']);
$to = mysql_escape_string($_POST['to']);
$toemail = mysql_escape_string($_POST['toemail']);
$message = mysql_escape_string($_POST['message']);
$query = "INSERT INTO cards (fromemail, from, to, toemail, message, stamp) VALUES ('$fromemail', '$from', '$to', '$toemail', '$message', 'now()')";
$results = mysql_query($query);
任何幫助,將不勝感激。提前致謝。
謝謝你的回答。我已經改變了字段/變量名稱,它的工作。 – Peter