English 中文(简体)
以html的形式使用外部网址
原标题:using external php file in html form
  • 时间:2010-08-27 22:36:17
  •  标签:
  • php

我试图创建简单的用户登记表。 页: 1 当我点击提交书子时,它就进入了<编码>register.php网页,但情况并非如此。 没有任何错误或任何东西。 我在<编码>上有一些<代码>echo的声明,载于register.php,但同时也不做任何工作。

这是<代码>index.html:

<form action="register.php" method="post">
<table width="384" border="1" align="center">
<? echo  <tr><td colspan="2"> .$final_report. </td></tr> ;?>
<tr>
<td width="50%">Username:</td>
<td width="50%"><label>
  <input name="username" type="text" id="username" size="30" />
</label></td>
</tr>
<tr>
  <td>Password:</td>
  <td><input name="password" type="password" id="password" value="" size="30" /></td>
</tr>
<tr>
  <td>Email:</td>
  <td><input name="email" type="text" id="email" size="30" /></td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td><label>
    <input name="register" type="submit" id="register" value="Register" />
  </label></td>
</tr>
  </table>
  </form>    

这是<代码>register.php:

<? 
include_once"config.php";
if(isset($_POST[ register ])){
$username = $_POST[ username ];
$password = $_POST[ password ];
$email = $_POST[ email ];
$memip = $_SERVER[ REMOTE_ADDR ];
$date = date("d-m-Y");
if($username == NULL OR $password == NULL OR $email == NULL){
$final_report.= "Please complete the form below..";
}else{
if(strlen($username) <= 3 || strlen($username) >= 30){
$final_report.="Your username must be between 3 and 30 characters..";
}else{
$check_members = mysql_query("SELECT * FROM `members` WHERE `username` =     $username ");   
if(mysql_num_rows($check_members) != 0){
$final_report.="The username is already in use!";  
}else{ 
if(strlen($password) <= 6 || strlen($password) >= 12){
$final_report.="Your password must be between 6 and 12 digits and characters..";
}else{
if(!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$",         $email)){ 
$final_report.="Your email address was not valid..";
}else{
$create_member = mysql_query("INSERT INTO `members` (`id`,`username`, `password`,`email`, `ip`, `date`) 
VALUES(  , $username , $password , $email , $memip , $date )"); 
$final_report.="Thank you for registering, you may login."; 
}}}}}}
?>

谁能看到错误?

最佳回答
include_once"config.php"

你似乎失去了一个空间。 《include_once “config.php” (notice thespace in between) or include_once("config.php”

还请在<编码>上设置<代码>final_report,<>register.php,但我看不出你实际印刷任何东西。

<><>Edit>: 我看到你试图在<代码>index.php上打印。 除非列入<编码>register.php,否则你会赢得一定的工作。 直接编号为index.html。 为什么没有哪怕有一个单独的<代码>register.php文档,有登记稿和超文本?

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签