我正在研究Php Lanuage并且我创建了一个简单的程序并且它给出了错误? [英] I'm Studying Php Lanuage And I Created A Simple Program And It Gives An Error?

查看:71
本文介绍了我正在研究Php Lanuage并且我创建了一个简单的程序并且它给出了错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个简单的php程序,其中包含文本框,如果用户输入内容并点击提交按钮......

数据将被添加到MySql数据库..



简单如此.........



这是我的代码:







i have created a simple php program which includes textbox and if user input something and hit the submit button...
the data will be added to the MySql database..

Simple as that.........

here is my code :



<html>
 <head>
  <title>PHP Test</title>
 </head>
<form method="post" action="input.php">
  Name: <input type="text" name="name" size="20">
<!--  Address: <input type="text" name="address" size="40">-->
<input type="submit" name="submit"  value="Sent">
</form>
 <body>
 <?php



 //the example of inserting data with variable from HTML form

mysql_connect("localhost","root","promod19861030");//database connection

mysql_select_db("empdata");



// Get values from form

$Fname=$_POST['name'];

//$address = $_POST['address'];



//inserting data order

$order = "INSERT INTO empname
       (empName)
      VALUES
       ('$Fname')";



//declare in the order variable

$result = mysql_query($order);  //order executes

if($result)

{

 echo("

Input data is succeed");

}

else

{

 echo("

Input data is fail");

}



 ?>
 </body>
</html>





我有2列的Mysql数据表

id将自动增加

名称将从文本框



但是当我执行这个



Notic e:未定义的索引:第18行的C:\ xampp \\\ htdocs \ newEmptyPHP1.php中的名称

输入数据成功



这个通知和

我输入东西后点击提交,它会显示



找不到对象!



在此服务器上找不到请求的URL。引用页面上的链接似乎是错误的或过时的。请告知该页面的作者有关错误。



如果您认为这是服务器错误,请联系网站管理员。

错误404

localhost

Apache / 2.4.7(Win32)OpenSSL / 1.0.1e PHP / 5.5.6 ....



请帮我解决这个案例.............



and i have Mysql datatable with 2 columns
id will automatically increment
name will be added from the textbox

but when i execute this

Notice: Undefined index: name in C:\xampp\htdocs\newEmptyPHP1.php on line 18
Input data is succeed

this notification and
after i input something and hit submit, it'll show

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.6....

please help me to solve this case.............

推荐答案

Fname =
Fname=


_POST [' name'];

//
_POST['name']; //


address =
address =


这篇关于我正在研究Php Lanuage并且我创建了一个简单的程序并且它给出了错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆