【发布时间】:2014-10-17 23:37:28
【问题描述】:
我是 PHP 和 HTML 表单的新手。我正在尝试将下面的表单数据发送到我的 PHP 脚本 sendms.php 似乎 php 脚本没有从 html 表单获取输入数据。
<form action="sendsms.php" method="post" >
<div id="space">Cell:<div><input type="number" name="phone" id="number" ></div></div>
<div id="space"><div>Message</div><div><input type="text" name="message" id="message"> </div></div>
<div id="button"><input type="submit" name="send" value="Send" id="button" ></div>
</form>
这是我的 PHP 文件 sendms.php
<?php
// this line loads the library
require('twilio-php/Services/Twilio.php');
$account_sid = 'REMOEVD';
$auth_token = 'REMOVED';
$client = new Services_Twilio($account_sid, $auth_token);
$client->account->messages->create(array(
'To' => $_POST['phone'];,
'From' => "+16194523868",
'Body' => $_POST['message'];,
));
【问题讨论】:
-
您正在使用
method="post",但尝试读取$_GET,您需要使用$_REQUEST或$_POST