Whatever data is being submitted is inserted into the image, and the name itself is inserted into it. Why is it that the value of name is not plugged in? Can someone please try my code for me?
This is 1.php.
"SET NAMES 'utf8'")); $rs = $db -> prepare("select * from `baidu`;"); $rs -> execute(); $list = $rs -> fetchAll(PDO::FETCH_ASSOC);?>
'; echo $v['name'].'
'; echo $v['num'].'
'; echo $v['site'].'
'; echo $v['content'].'
'; } ?>
This is 2.php.
exec("INSERT INTO baidu(type,name,num,site,content)VALUES ('{$_POST['select']}','{$_POST['name']}','{$_POST['num']}','{$_POST['site']}','{$_POST['content']}')"){echo "";}?>
Reply content:
Whatever data is being submitted is inserted into the image, and the name itself is inserted into it. Why is it that the value of name is not plugged in? Can someone please try my code for me?
This is 1.php.
"SET NAMES 'utf8'")); $rs = $db -> prepare("select * from `baidu`;"); $rs -> execute(); $list = $rs -> fetchAll(PDO::FETCH_ASSOC);?>
'; echo $v['name'].'
'; echo $v['num'].'
'; echo $v['site'].'
'; echo $v['content'].'
'; } ?>
This is 2.php.
exec("INSERT INTO baidu(type,name,num,site,content)VALUES ('{$_POST['select']}','{$_POST['name']}','{$_POST['num']}','{$_POST['site']}','{$_POST['content']}')"){echo "";}?>
Now that you're using PDO, the 2.php insertion logic changes:
$sql = "INSERT INTO baidu(type,name,num,site,content) VALUES (:type,:name,:num,:site,:content)";$stmt = $pdo->prepare($sql);$stmt->execute(array(':type' => $_POST['type'], ':name' => ....));
Well, actually I am also small white, ' {$_post[' name '} ' in this name next to the quotation marks need not be escaped, because there is already a quotation mark, I have not tried, will not be the problem
The form has no value, and after submission it is printed to see if the data is correct.