hello~
i just join in this discussion ....er i am Chinese,so my English is poor
i search this problem in Google,but i can't find some useful information
some people said PHP version cause this problem...
i use PHP 5.3.3 but i saw PHP 5.2.1 books

<html>
<title>
test
</title>
<body>
<div align="center">注册表单
<form id="form1" name="form1" method="post" action="1.php">
用户:<input type="text" name=:"username" id="username" /><br>
密码:<input type="text" name=:"pass" id="pass" /><br>
邮件:<input type="text" name=:"email" id="email" /><br>
<input type="submit" name=:"button" id="button" value="提交" />
</form>
</div>
</body>
</html>
<?php
echo "注册的用户名: ".$_POST["username"]."<br>";
echo "注册的密码: ".$_POST["pass"]."<br>";
echo "注册的邮件: ".$_POST["email"]."<br>";
echo "表单按钮: ".$_POST["button"]."<br>";
?>

error:
Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 7
注册的用户名:

Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 8
注册的密码:

Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 9
注册的邮件:

Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 10
表单按钮:

thans your support:)

Recommended Answers

All 10 Replies

why are there ":" in every input-element?

<html>
<title>
test
</title>
<body>
<div align="center">????
<form id="form1" name="form1" method="post" action="1.php">
??:<input type="text" name="username" id="username" /><br>
??:<input type="text" name="pass" id="pass" /><br>
??:<input type="text" name="email" id="email" /><br>
<input type="submit" name="button" id="button" value="??" />
</form>
</div>
</body>
</html>

and the 1.php:

<?php if(isset($_POST['button'])) {
echo "??????: ".$_POST["username"]."<br>";
echo "?????: ".$_POST["pass"]."<br>";
echo "?????: ".$_POST["email"]."<br>";
echo "????: ".$_POST["button"]."<br>";
}
?>

What are you asking?

error:

Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 7
注册的用户名:

Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 8
注册的密码:

Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 9
注册的邮件:

Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 10
表单按钮:

I tested the solution i posted above and it worked...

why are there ":" in every input-element?

<html>
<title>
test
</title>
<body>
<div align="center">????
<form id="form1" name="form1" method="post" action="1.php">
??:<input type="text" name="username" id="username" /><br>
??:<input type="text" name="pass" id="pass" /><br>
??:<input type="text" name="email" id="email" /><br>
<input type="submit" name="button" id="button" value="??" />
</form>
</div>
</body>
</html>

and the 1.php:

<?php if(isset($_POST['button'])) {
echo "??????: ".$_POST["username"]."<br>";
echo "?????: ".$_POST["pass"]."<br>";
echo "?????: ".$_POST["email"]."<br>";
echo "????: ".$_POST["button"]."<br>";
}
?>

just for a good look.....Does not work

I tested the solution i posted above and it worked...

= =....i dont know.. its doesn't work in my computer

What are you asking?

error:
Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 7
注册的用户名:

Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 8
注册的密码:

Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 9
注册的邮件:

Notice: Undefined index: in D:\Apache2.2\htdocs\1.php on line 10
表单按钮:

Yes in the PHP Manual you will find everywhere

This feature has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.

in functions for global Variables like $_GET, $_POST, $_SERVER

But I don't know any solutions for this problem, sorry

Please give suggestions, why i'm having Undefined index: amount error in line 11. thanks
<html>
<body>
<form action="conditionalproblem.php" method="POST">
Please Pay P80.
<input type="text" value = "" name="amount">
<INPUT TYPE="submit" value="PAY">
</form>
<?php

//CONDITIONAL STATEMENTS - PROBLEM SOLVING
if ($_POST <> null )
{
if ($_POST > 80)
{
$change = $_POST - 80;
echo "You're change is :<i>". $change." </i>";
}
else if ($_POST < 80)
{
$change = ($_POST - 80) * -1;
echo "Not enough. Please pay additional :<i>". $change." </i>";
}
else
{
echo "Thank you for giving exact amount.";
}
}
?>
</body>
</html>

Hi aiioef, Its not a big problem , Try this, <?php error_reporting(E_ALL ^ E_NOTICE); ?> include this code on every top of the php file. That's all

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.