sales, quantity 및 paid 필드가 포함 된 sales라는 MySQL 테이블이 있습니다.CMS를 통해 양식의 콘텐츠를 저장할 때의 문제
양식을 만드는 사용자 지정 방법과 사용할 사용자 지정 양식 필드가있는 CMS 시스템을 사용하고 있습니다.
내가 알 수있는 한, formfield에 주어진 id는 삽입 할 테이블 이름으로 사용되는 것이다. 양의
<?php
include("../../include/session.php");
include("include/tables.php");
include("include/fields.php");
//if you need to ovveride the phpbmsTable class make sure to include the modules file
include("include/sales.php");
if(!isset($_GET["backurl"]))
$backurl = NULL;
else{
$backurl = $_GET["backurl"];
if(isset($_GET["refid"]))
$backurl .= "?refid=".$_GET["refid"];
}
$thetable = new sales($db, "tbld:490cf2d1-1c72-7b99-461d-b1b8e68553c4");
$therecord = $thetable->processAddEditPage();
if(isset($therecord["phpbmsStatus"]))
$statusmessage = $therecord["phpbmsStatus"];
$pageTitle = "Sales";
$phpbms->cssIncludes[] = "pages/menus.css";
$phpbms->jsIncludes[] = "modules/base/javascript/menu.js";
$theform = new phpbmsForm();
$theinput = new inputSmartSearch($db, "product", "Choose Product",$therecord["product"], "Choose Product", TRUE, NULL, NULL, TRUE, $required=true);
$theinput->setAttribute("class","important");
$theform->addField($theinput);
$theinput = new inputField("quantity",$therecord["quantity"],"Quantity",true, NULL, 1);
$theinput->setAttribute("class","important");
$theform->addField($theinput);
$theinput = new inputCheckbox("paid", $therecord["paid"], "Paid");
$theform->addField($theinput);
$thetable->getCustomFieldInfo();
$theform->prepCustomFields($db, $thetable->customFieldsQueryResult, $therecord);
$theform->jsMerge();
include("header.php");
?><div class="bodyline">
<?php $theform->startForm($pageTitle)?>
<div id="leftSideDiv">
<fieldset>
<legend><label for="S">Sales</label></legend>
<p class="big"><?php $theform->showField("product"); ?></p>
<p class="big"><?php $theform->showField("quantity"); ?></p>
<p class="big"><?php $theform->showField("paid"); ?></p>
</fieldset>
</div>
<?php
$theform->showGeneralInfo($phpbms,$therecord);
$theform->endForm();
?>
</div>
<?php include("footer.php");?>
내용과 문제없이 테이블에 저장된 얻을 지불하지만 제품은 내가 어떤 점에서 때문에 말할 수있는 것과,하지 않습니다, 다음과 같이 내가 사용하고
내 현재 양식입니다 id에 'ds-'가 붙습니다. 나는 다른 입력 필드를 사용하고 있기 때문에 이것이라고 생각한다.
이
폼을 저장하려는 후 POST의 결과이다 :어레이 ([제품] => 75c72a6a-83d9-11df-951a-fa9c1ec271f2 [DS-제품] => 코로나 [수량] => 2 [paidby] => 0 [createdby] => [creationdate] => [command] => [modifiedby] => [cancelclick] => 0 [modifieddate] => [uuid] => : 4402add3-b884-43e6 -04ad-c76d92ee465b [id] =>)
대신 UUID가 제품 이름 대신 제품에 삽입됩니다.
이 문제에 대한 해결책이 있는지 궁금합니다. 나는 쿼리 코드를 변경하기 위해 직접 액세스 할 수 있다고 생각지 않으며, 하이픈이 연결된 필드 이름에 액세스하도록 쿼리를 변경할 수 없기 때문에 ds-product로 제품의 이름을 바꿀 수 없습니다.
위의 예와 같이 클래스를 재정의 할 가능성이 있습니다. here 샘플을 기반으로 한 sales.php가 포함되어 있습니다.
어쨌든 insertRecord 함수를 재정의하는 해법은 무엇입니까? 아니면 더 간단한 해결책이 있습니까?