問題我在自定義儀表板single_page與數據庫正確交互時遇到了一些麻煩。Concrete5自定義儀表板single_page /管理面板
截圖:http://i54.tinypic.com/2lvh45d.jpg
見證代碼(single_pages /儀表板/ testimonials.php):http://pastebin.com/PK4ziRih
newTestimonials.php代碼:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$testimonial_name = $_POST['testimonial_name'];
$testimonial_content = $_POST['testimonial_content'];
$url = "http://www.eurofloors.co.nz/dashboard/testimonials/";
$con = mysql_connect('localhost', 'username', 'password');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("eurofloo_website", $con);
$sql = "INSERT INTO testimonials (id, name, content) VALUES " . $testimonial_name . $testimonial_content;
mysql_query($sql);
/* Redirect browser */
header("Location:" .$url);
/* Make sure that code below does not get executed when we redirect. */
exit;
?>
save_testimonials.php代碼:
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$existing_testimonials_update = $_POST['data'];
$con = mysql_connect('localhost', 'username', 'password');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("eurofloo_website", $con);
$sql = "INSERT INTO testimonials VALUES " . $existing_testimonials_update;
$result = mysql_query($sql);
mysql_close($con);
?>
我的問題與thi當我提交新的推薦形式或點擊保存在底部的數據網格上時。我得到了Page Not Found錯誤,因爲concrete5似乎無法看到在窗體的action屬性中設置的php文件。 爲什麼會出現這種情況,或者是因爲我沒有使用MVC方法,是否有明顯的原因?
請問您能指點正確的方向嗎? 我正在尋找的主要事情是某些文檔的控制器&模型語法的數據庫交互和表單數據處理的例子。
任何意見或資源給予非常感謝。
ps:我對PHP還是比較陌生,所以我可能會以錯誤的方式接近代碼。