I am trying to implement the creating topic part in forum
Why I can't use the another php file, say b.php to get data that sent from a.php?
$topic=$_POST['title'];
$detail=$_POST['content'];
$name=$_POST['username'];
Errors show message that undefined index at these 3 inputs.
Because you are calling this script without sending POST
data.
Use it in following way:
$topic = empty($_POST['title']) ? null : $_POST['title'];
$detail = empty($_POST['detail']) ? null : $_POST['detail'];
$name = empty($_POST['name']) ? null : $_POST['name'];
It will avoid errors and if you just request script without POST
ing, variables will contain null values
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.