I am trying to use more object oriented code with PHP. I am trying to add a record to a table with the submit button, but I do I do it? I need some direction. This is not working. Thanks!
Code:
<form id="CMSAdd" name="CMSAdd" onsubmit="<? php $addCMSRecord = new GetCMSRecord();$addCMSRecord -> save_AddRecord(); ?>" method= $_REQUEST >
if (document.CMSAdd.R1.value == "ENewsletter" ) {
/*** sql to INSERT a new record ***/
$sql = "INSERT INTO enewsletter (enews_year, enews_month, enews_title, enews_path, enews_edition)
VALUES ( CMSAdd.txtEYear.value, CMSAdd.optEMonth.value, CMSAdd.txtETitle.value, CMSAdd.txtELink.value, CMSAdd.optEEdition.value) or die('Couldn't insert data from eNewsletter table: '.mysql_error())";
return $sql;
}
Comment