我有一個表單,我想提交兩個條目。它的entry_id和電子郵件。我有一個PHP函數開頭是這樣的:提交表單,然後在php函數中插入值
public function theFunction($data) {
if (false && !empty($data['email']) && !empty($data['entry_id'])) {
$sql = $this->db->select()
->from('votes')
->where('entry_id = ?', $data['entry_id'])
->where('email = ?', $data['email'])
->order('created DESC');
但是我怎麼來調用一個PHP文件這一功能,並從我的形式帶來的價值,這是據我已經來了,但它似乎工作:
$fields = array("email","entry_id");
$data = array();
foreach($fields as $field){
$data[$field] = $_POST[$field];
}
echo theFunction($data);
有誰知道我該怎麼辦?
我真的不明白這個問題,但它聽起來像你想包括filename.php。 http://stackoverflow.com/questions/5942224/how-to-call-a-function-in-php-in-another-form – Matt
你可能想要再次檢查該功能。有條件的'if(false && ...)'將總是返回'false',並且SQL永遠不會被執行。 –