0

I have a simple php coding problem here. I have a button id 'register' for user to click. But the code below does not run it once the button is clicked.

<?php
try {

 if (isset($_POST['register'])) {
    require_once('library.php');

    $user_id = $identity->user_id; 
    $status_type = 'M';
    $data = array('status' => $status_type);

    $dbWrite->update('user', $data, "user_id = $user_id");

    header('Location: main.php');
    exit;
 }

} catch (Exception $e) {
  echo $e->getMessage();
}

Anyone can help me ?

4

2 回答 2

0

写下来print_r($_POST);看看缺少什么

也许是一种语法form

于 2013-05-08T20:27:24.923 回答
0

必须错过按钮的名称属性。在 HTML 中定义按钮,如下所示

<input type="submit" name="register" value="register" />
于 2013-05-08T16:24:57.897 回答