Php html中的文本框
这是我的代码:Php html中的文本框,php,javascript,html,css,Php,Javascript,Html,Css,这是我的代码: <html> <body> <BR><p><U>Add contact...</U></p><BR> Name: <INPUT TYPE="text" NAME="firstbox"> Id.number: <INPUT TYPE="text" NAME="idbox"> <?php session_s
<html>
<body>
<BR><p><U>Add contact...</U></p><BR>
Name: <INPUT TYPE="text" NAME="firstbox">
Id.number: <INPUT TYPE="text" NAME="idbox">
<?php
session_start();
$username=$_SESSION['UserID'];
$s_name=$_GET['firstbox'];
$s_id=$_GET['idbox'];
$db = mysql_connect("???????", "???????", "");
mysql_select_db("???????",$db);
$result = mysql_query("SELECT * FROM contacts WHERE u_id='$username' and c_id='$s_id'",$db);
$myrow = mysql_fetch_row($result);
if(!$myrow) {
mysql_query("INSERT INTO contacts(u_id, c_name, c_id) VALUES ('$username','$s_name','$s_id')",$db);
header("Location: http://?????/protectedpage.php");
} else {
header("Location: http://?????contact1.htm");
}
?>
</body>
</html>
我添加了一个if语句来检查,您所有问题的答案都是“是”
$idbox = $_POST['idbox'];
If (intval($idbox) > 5) {
Echo "idbox value greater than 5";
}
有没有可能在你的代码中添加一个
,这样在IE的怪癖模式下看起来就不会像一堆废话?除此之外,你问的是可能的,但是?是的,有可能,你自己试试,让我们知道你遇到了什么问题。另外,请升级到mysqli或PDO语句,mysql*函数集在PHPYes中已经被弃用了,是的,也是的。我建议您在一个问题中提出3个相对简单的问题之前,先搜索每个问题。我们还希望看到一些证据表明您在提出问题之前尝试过一些事情。您的代码易于SQL注入。请改用参数化查询。但它确实回答了问题:):)
$firstbox = $_POST['firstbox'];
If ($firstbox === "") {
Echo "firstbox Empty";
}
$idbox = $_POST['idbox'];
If ($idbox === "") {
Echo "idbox Empty";
}
$idbox = $_POST['idbox'];
If (intval($idbox) > 5) {
Echo "idbox value greater than 5";
}