本文将为您提供关于php–使用if(isset($_POST[‘submit’]))在脚本打开时不显示echo不起作用的详细介绍,我们还将为您解释php提示的相关知识,同时,我们还将为您提供关于Ang
本文将为您提供关于php – 使用if(isset($_ POST [‘submit’]))在脚本打开时不显示echo不起作用的详细介绍,我们还将为您解释php提示的相关知识,同时,我们还将为您提供关于Angular 2将表单分配给不起作用的变量#f =“form”(submit)=“onSubmit(f.value)”、Angular,如何检查 Post 是否完成 ToPromise() 和 subscribe() 不起作用、chrome浏览器上isset($_POST[''submit''])不返回ture、chrome浏览器下isset($_POST[''submit''])不返回ture的实用信息。
本文目录一览:- php – 使用if(isset($_ POST [‘submit’]))在脚本打开时不显示echo不起作用(php提示)
- Angular 2将表单分配给不起作用的变量#f =“form”(submit)=“onSubmit(f.value)”
- Angular,如何检查 Post 是否完成 ToPromise() 和 subscribe() 不起作用
- chrome浏览器上isset($_POST[''submit''])不返回ture
- chrome浏览器下isset($_POST[''submit''])不返回ture
php – 使用if(isset($_ POST [‘submit’]))在脚本打开时不显示echo不起作用(php提示)
以下是代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Exam Interface</title> <Meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <p><strong>NOTE: </strong>If a search Box is left blank,then the form will search for all data under that specific field</p> <form action="exam_interface.PHP" method="post" name="sessionform"> <!-- This will post the form to its own page"--> <p>Session ID: <input type="text" name="sessionid" /></p> <!-- Enter Session Id here--> <p>Module Number: <input type="text" name="moduleid" /></p> <!-- Enter Module Id here--> <p>Teacher Username: <input type="text" name="teacherid" /></p> <!-- Enter Teacher here--> <p>Student Username: <input type="text" name="studentid" /></p> <!-- Enter User Id here--> <p>Grade: <input type="text" name="grade" /></p> <!-- Enter Grade here--> <p>Order Results By: <select name="order"> <option value="ordersessionid">Session ID</option> <option value="ordermoduleid">Module Number</option> <option value="orderteacherid">Teacher Username</option> <option value="orderstudentid">Student Username</option> <option value="ordergrade">Grade</option> </select> <p><input type="submit" value="Submit" /></p> </form> <?PHP $username="xxx"; $password="xxx"; $database="mobile_app"; MysqL_connect('localhost',$username,$password); @MysqL_select_db($database) or die("Unable to select database"); $sessionid = isset ($_POST['sessionid']) ? $_POST['sessionid'] : ""; $moduleid = isset ($_POST['moduleid']) ? $_POST['moduleid'] : ""; $teacherid = isset ($_POST['teacherid']) ? $_POST['teacherid'] : ""; $studentid = isset ($_POST['studentid']) ? $_POST['studentid'] : ""; $grade = isset ($_POST['grade']) ? $_POST['grade'] : ""; $orderfield = isset ($_POST['order']) ? $_POST['order'] : ""; $sessionid = MysqL_real_escape_string($sessionid); $moduleid = MysqL_real_escape_string($moduleid); $teacherid = MysqL_real_escape_string($teacherid); $studentid = MysqL_real_escape_string($studentid); $grade = MysqL_real_escape_string($grade); switch ($orderfield) { case 'ordersessionid': $orderfield = 'gr.SessionId'; break; case 'ordermoduleid': $orderfield = 'm.ModuleId'; break; case 'orderteacherid': $orderfield = 's.TeacherId'; break; case 'orderstudentid': $orderfield = 'gr.StudentId'; break; case 'ordergrade': $orderfield = 'gr.Grade'; break; } $ordertable = $orderfield; $result = MysqL_query("SELECT * FROM Module m INNER JOIN Session s ON m.ModuleId = s.ModuleId JOIN Grade_Report gr ON s.SessionId = gr.SessionId JOIN Student st ON gr.StudentId = st.StudentId WHERE ('$sessionid' = '' OR gr.SessionId = '$sessionid') AND ('$moduleid' = '' OR m.ModuleId = '$moduleid') AND ('$teacherid' = '' OR s.TeacherId = '$teacherid') AND ('$studentid' = '' OR gr.StudentId = '$studentid') AND ('$grade' = '' OR gr.Grade = '$grade') ORDER BY $ordertable ASC"); $num=MysqL_numrows($result); if(isset($_POST['submit'])){ echo "<p>Your Search: <strong>Session ID:</strong> "; if (empty($sessionid))echo "'All Sessions'"; else echo "'$sessionid'";echo ",<strong>Module ID:</strong> "; if (empty($moduleid))echo "'All Modules'"; else echo "'$moduleid'";echo ",<strong>Teacher Username:</strong> "; if (empty($teacherid))echo "'All Teachers'"; else echo "'$teacherid'";echo ",<strong>Student Username:</strong> "; if (empty($studentid))echo "'All Students'"; else echo "'$studentid'";echo ",<strong>Grade:</strong> "; if (empty($grade))echo "'All Grades'"; else echo "'$grade'"; "</p>"; echo "<p>Number of Records Shown in Result of the Search: <strong>$num</strong></p>"; echo "<table border='1'> <tr> <th>Student Id</th> <th>Forename</th> <th>Session Id</th> <th>Grade</th> <th>Mark</th> <th>Module</th> <th>Teacher</th> </tr>"; while ($row = MysqL_fetch_array($result)){ echo "<tr>"; echo "<td>" . $row['StudentId'] . "</td>"; echo "<td>" . $row['Forename'] . "</td>"; echo "<td>" . $row['SessionId'] . "</td>"; echo "<td>" . $row['Grade'] . "</td>"; echo "<td>" . $row['Mark'] . "</td>"; echo "<td>" . $row['ModuleName'] . "</td>"; echo "<td>" . $row['TeacherId'] . "</td>"; echo "</tr>"; } echo "</table>"; } MysqL_close(); ?> </body> </html>
任何帮助将不胜感激,谢谢.
解决方法
<p><input type="submit" value="Submit" name="submit" /></p>
Angular 2将表单分配给不起作用的变量#f =“form”(submit)=“onSubmit(f.value)”
不工作的HTML:
<form #f="form" (submit)="addParty(f.value)"> <div>{{f.value}}</div> </form>
来自示例的parties-form.html的原始HTML代码:
<form [ng-form-model]="partiesForm" #f="form" (submit)="addParty(f.value)"> <label>Name</label> <input type="text" ng-control="name"> <label>Description</label> <input type="text" ng-control="description"> <label>Location</label> <input type="text" ng-control="location"> <button>Add</button> <div>{{f}}</div> <div>{{f.value}}</div> </form>
和JS组件party-form.ts:
/// <reference path="../../typings/angular2-meteor.d.ts" /> import {Component,View} from 'angular2/angular2'; import {FORM_DIRECTIVES,FormBuilder,Control,ControlGroup,Validators} from 'angular2/angular2'; import {Parties} from 'collections/parties'; @Component({ selector: 'parties-form' }) @View({ templateUrl: 'client/parties-form/parties-form.html',directives: [FORM_DIRECTIVES] }) export class PartiesForm { partiesForm: ControlGroup; constructor() { var fb = new FormBuilder(); this.partiesForm = fb.group({ name: ['',Validators.required],description: [''],location: ['',Validators.required] }); // Test console.log(this.partiesForm.value); } addParty(party) { console.log("assparty",party); return true; if (this.partiesForm.valid) { Parties.insert({ name: party.name,description: party.description,location: party.location }); (<Control>this.partiesForm.controls['name']).updateValue(''); (<Control>this.partiesForm.controls['description']).updateValue(''); (<Control>this.partiesForm.controls['location']).updateValue(''); } } } console.log("PartiesForm loaded");
我复制了流星角2样本,看那里的确切代码.像ng-book这样的其他样本也使用它作为onSubmit功能
#f="form" (submit)="onSubmit(f.value)"
解决方法
Angular,如何检查 Post 是否完成 ToPromise() 和 subscribe() 不起作用
如何解决Angular,如何检查 Post 是否完成 ToPromise() 和 subscribe() 不起作用?
我不知道为什么(这是我第一次尝试),但即使我的帖子请求有效,我也无法在完成后打印任何内容。
在 TS 文件中,这是我的代码:
this.appService.sendpath({ title: servicetoPath }).toPromise().then
(
()=>
{
console.log("The path is set!")
}
);
那么这是“appService”我的中间人
sendpath(path: any): Observable<any> {
console.log("path from app-service: "+ JSON.stringify(path))
return this.httpClient.post(''http://localhost:3000/compare'',path)
}
当然是控制台消息“路径已设置!”当“来自应用服务的路径”完美运行时,永远不会显示在控制台上。
最终目标是在 POST 完成后调用一个函数,但现在,我只想在控制台上打印一些东西。
感谢您的帮助。
更新: 似乎是因为我的 Post 请求处于永久挂起状态。我该如何解决这个问题?
解决方法
为什么不直接订阅您的功能?
this.appService.sendPath({ title: serviceToPath })
.subscribe(res => {
console.log("The path is set!")
});
,
确实是服务器端出错了。再次感谢 Iafanasov,他给了我很大的线索!
//If you forget this the promise will not work and you will never know when POST is over
res.status(205).send('''');
我没有发送状态,所以前端承诺不知道什么时候结束。
chrome浏览器上isset($_POST[''submit''])不返回ture
chrome浏览器下isset($_POST[''submit''])不返回ture
在IE下能成功,但在chrome下不能,是否是浏览器自身的BUG?
------解决方案--------------------
代码没有问题,你怎么测试的。chrome 什么版本。
------解决方案--------------------
你到gg浏览器里看看有没有 gg的开发人员工具跟一下
------解决方案--------------------
注意缓存
------解决方案--------------------
Chrome是有问题的,但是采用提交按钮的值的做法尽量不要采用。另外如果用javascript的form.submit()的话,IE下也不提交的。建议采用hidden变量。
------解决方案--------------------
直接打印$_POST看下有没有
------解决方案--------------------
chrome浏览器下isset($_POST[''submit''])不返回ture
在IE下能成功,但在chrome下不能,是否是浏览器自身的BUG?
回复讨论(解决方案)
贴代码来。
Chrome浏览器是最遵守W3C标准的了,只能说你的代码有不符合W3C标准的地方
chrome 右键-》审查元素-》NETWORK。查看有关信息。
if(isset($_POST[''submit1''])){
echo "You like the following languages:
";
foreach($_POST[''lang''] AS $lang){
$lang=htmlentities($lang);
echo "$lang
";
}
}
代码没有问题,你怎么测试的。chrome 什么版本。
18.0.1025.151 直接chrome查看的
你点提交了吗?
先看看你有没有POST ''submit1'' 吧...
嗯啊,IE9是对的,我在想是不是chrome不能通过$_POST返回表单submit的数据类型
你点提交了吗?
有啊
先看看你有没有POST ''submit1'' 吧...
怎么个有法?你从哪判断有?
有啊
引用 7 楼 的回复:
先看看你有没有POST ''submit1'' 吧...
IE9能够打印出submit后的表单内容,我通过POST方式传递,然后通过$_POST获取的
怎么个有法?你从哪判断有?
引用 9 楼 的回复:
有啊
引用 7 楼 的回复:
先看看你有没有POST ''submit1'' 吧...
$_POST[''submit1'']能够获取到submit1这个字符串
你到gg浏览器里看看有没有 gg的开发人员工具跟一下
$_POST[''submit1'']能够获取到submit1这个字符串
注意缓存
Chrome是有问题的,但是采用提交按钮的值的做法尽量不要采用。另外如果用javascript的form.submit()的话,IE下也不提交的。建议采用hidden变量。
直接打印$_POST看下有没有
直接打印$_POST看下有没有
+1
你先看看你的$_POST数组是否有值,如果数组为空,那么你的判定肯定是错的,因为都没有这个数组元素存在。而且为了避免重复提交等问题,你还是用javascript提交表单比较好。
我也碰到了同样的问题,通过IE用POST提交数组没有问题,但是chrome不行,用print_r($_POST)看不到提交的数组变量。
我们今天的关于php – 使用if(isset($_ POST [‘submit’]))在脚本打开时不显示echo不起作用和php提示的分享就到这里,谢谢您的阅读,如果想了解更多关于Angular 2将表单分配给不起作用的变量#f =“form”(submit)=“onSubmit(f.value)”、Angular,如何检查 Post 是否完成 ToPromise() 和 subscribe() 不起作用、chrome浏览器上isset($_POST[''submit''])不返回ture、chrome浏览器下isset($_POST[''submit''])不返回ture的相关信息,可以在本站进行搜索。
本文标签: