为什么php表单不提交?
我正在为一个网站的在线招生开发一个脚本。下面是页面的为什么php表单不提交?,php,html,Php,Html,我正在为一个网站的在线招生开发一个脚本。下面是页面的php代码。问题是它没有提交 <?php include ("include/header.php"), include ("include/config.php"); if(isset($_POST['applyAdmission'])) { $admission_no = $_POST['admission_no']; $f_name = $_POST['f_name']; $l_name = $_POST[
php
代码。问题是它没有提交
<?php
include ("include/header.php"), include ("include/config.php");
if(isset($_POST['applyAdmission'])) {
$admission_no = $_POST['admission_no'];
$f_name = $_POST['f_name'];
$l_name = $_POST['l_name'];
$p_add = $_POST['p_add'];
$c_add = $_POST['c_add'];
$dob = $_POST['dob'];
$education = $_POST['education'];
$mobile = $_POST['mobile_no'];
$course = $_POST['course'];
$subjects = $_POST['subjects'];
$timing = $_POST['timing'];
$filepath_pic = $_FILES['picture']['name'];
$res_move_pic = move_uploaded_file($_FILES['picture']['tmp_name'], "/admission/".$filepath_pic);
$filepath_sign = $_FILES['sign']['name'];
$res_move_sign = move_uploaded_file($_FILES['sign']['tmp_name'], "/admission/".$filepath_sign);
$agree_terms = $_POST['agree_terms'];
$agree_cond = $_POST['agree_cond'];
if ($res_move_pic == 1 && $res_move_sign == 1 ) {
$query = "INSERT into online_admission (f_name, l_name, p_add, c_add, dob, degree, mobile_no, course, subjects, timing, pic, sign, agree_terms, agree_cond, applied_on)
values ('$f_name','$l_name','$p_add','$c_add','$dob','$education','$mobile','$course','$subjects','$timing','$filepath_pic','$filepath_sign','$agree_terms','$agree_cond','now()')";
$res = mysql_query($query) or die("ERROR: Unable to insert into database.");
if ($res == 1) {
header('Location:http://adarshclasses.in/admission_success.php/');
exit();
} else {
header('Location:http://adarshclasses.in/admission_failed.php/');
exit();
}
} else {
echo "Error in updateing profile pic and sign";
}
} else {
//echo "Please submit the form, thanks!";
}
;?>
将
更改为
。按钮可以使用javascript,但仅使用php按钮无法使用post数据。您无法通过
获取POST
数据。为此,您必须使用
改变这个
<button type="text" name="submit" class="btn btn-success btn-lg btn-block" name="applyAdmission"> Submit my application form </button>
您可以查看更多详细信息已更改
<button type="text">
到
更改
button type="text" to type="button" Or input type ="submit/button"
include ("include/header.php"), include ("include/config.php");
<button type="text"...
您需要更改此代码:
<button type="text" name="submit" class="btn btn-success btn-lg btn-block" name="applyAdmission"> Submit my application form </button>
我看到了一个小语法错误,我认为解决这个问题将解决您的问题 改变
include ("include/header.php"), include ("include/config.php");
<button type="text"...
到
为了向您显示语法错误,下面是一个示例:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
include("test.php"), include("someother.php");
输入类型不正确
您还应该更改按钮类型
改变
include ("include/header.php"), include ("include/config.php");
<button type="text"...
您正在使用的提交的HTML页面的输入类型背后的原因也请发布HTML。因此,我们可以找出问题所在。添加表单以获得完整性您的意思是单击“提交”按钮时不会发生任何事情?或者输入没有被保存??请你解释清楚。并显示您的HTML。是否包含数据库文件?//这是什么意思??您好,我用这种方式编辑了提交我的申请表
,现在它看起来可以工作了,但是在上传签名和图片时,他们的问题更多了,您能不能也弄清楚。您面临的问题是什么?它说“无法插入数据”意味着SQL查询注释有问题。这不是错误。使用此mysql\u错误($connectionvariable)代码>你所说的mysql\u错误($connectionvariable)是什么意思代码>我是一名前端开发人员,不太了解,请简要告诉我。考虑到OPs第一行代码中存在语法错误,我认为这清楚地表明他们还没有进行任何Php调试。在旧版本的php中,你可能可以做任何事情。它不像新版本那样敏感。不过我不确定
include ("include/header.php"), include ("include/config.php");
include ("include/header.php");
include ("include/config.php");
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');
include("test.php"), include("someother.php");
Parse error: syntax error, unexpected ',' in ...\tests\includeTest.php on line 6
<button type="text"...
<button type="submit"...
<input type="submit" name="" value="Submit">