Forum Moderators: coopster
Notice: Undefined index: T1 in c:\easyphp1-8\www\efiling\associationaddprocess.php on line 20"
<html>
<head>
<meta http-equiv="Content-Language" content="ja">
<title>Index</title>
</head>
<div style="position: absolute; width: 1146px; height: 842px; z-index: 1; left:10px; top:1px" id="layer2" align="center"> <body background="E-Filing%20Management%20System%20Picture/Snow.gif">
<p align="center">
<img border="0" src="E-Filing%20Management%20System%20Picture/logo-RR-gif.gif" width="957" height="245"></p>
<p align="center"><span lang="zh-cn"> </span></p>
<p align="center"><span lang="zh-cn"><img border="0" src="E-Filing%20Management%20System%20Picture/Association.gif" width="491" height="74"></span></p>
<p align="center"><span lang="zh-cn"> </span></p>
<div style="position: absolute; width: 191px; height: 28px; z-index: 2; left: 546px; top: 441px" id="layer4">
<font color="#FFFFFF"><span lang="en-us">
<font size="4" face="Arial Rounded MT Bold"> Association Name</font></span></font></div>
<div style="position: absolute; width: 70px; height: 24px; z-index: 1; left: 298px; top: 442px" id="layer3">
<font size="4" face="Arial Rounded MT Bold"><font color="#FFFFFF"><span lang="en-us">
Index</span></font></font></div>
<p align="center"><span lang="zh-cn">
</span><font color="#FFFFFF"><span lang="en-us">
<font face="Arial Rounded MT Bold"> </font>
<font size="4" face="Arial Rounded MT Bold"> </font></span></font></p>
<p align="center"><span lang="en-us"> </span>
<?php
echo"<form method='POST' action='AssociationAdd.php'>";
echo"<input type='text' name='T2' size='11'> ";
echo"<input type='text' name='T1' size='77'></p>";
echo"<p> <input type='submit' value=' Add ' name='submit' style='font-family: Times New Roman; color: #000000; font-weight: bold; font-size: 12pt'> ";
echo"<input type='reset' value=' Reset ' name='B2' style='font-family: Times New Roman; color: #000000; font-weight: bold; font-size: 12pt'> ";
echo"<input type='submit' value=' Back ' name='submit' style='font-family: Times New Roman; color: #000000; font-weight: bold; font-size: 12pt'></p>";
if(isset($_POST["submit"]))
{
$submit = $_POST["submit"];
$T1 = $_POST["T1"];
$T2= $_POST["T2"];
if($submit==" Add ")
{
print "<script language ='javascript'>window.location.href='AssociationAddProcess.php?T1=$T1&T2=$T2'</script>";
}
else if($submit==" Back ")
{
print "<script language ='javascript'>window.location.href='Association.php'</script>";
}
}
echo"</form>";
?>
</div>
</body>
</html>
This is the second page(AssociationAddProcess.php):
<html>
<head>
<meta http-equiv="Content-Language" content="ja">
<title>Index</title>
</head>
<body background="E-Filing%20Management%20System%20Picture/Snow.gif">
<p align="center">
<img border="0" src="E-Filing%20Management%20System%20Picture/logo-RR-gif.gif" width="957" height="245"></p>
<p align="center"><span lang="zh-cn"> </span></p>
<p align="center"><span lang="zh-cn"><img border="0" src="E-Filing%20Management%20System%20Picture/Association.gif" width="491" height="74"></span></p>
<?php
$id = $_POST["T2"];
$an = $_POST["T1"];
if ($id==null¦¦$an==null)
{
print"
<p align='center'> </p>
<table width='400' height='200' border='1' align='center' bordercolor='#66FF00'bgcolor='#0000FF'>
<td><div align='center'><font color='#FF0000' size='5'><p>Please Enter Index and Association Name Completely</p> </font></div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table> ";
print "<p align='center'> </p>";
echo "<HTML><META HTTP-EQUIV='REFRESH' CONTENT='2; URL=AssociationAdd.php'>
<CENTER><p> </p><p>
<tr>
<td align='center'><h12>please wait...</h12></td>
</tr>
</table><p> </p><p> </p></CENTER></BODY></HTML>";
}
else
{
$connection=mysql_connect("localhost","root","")
or die("<font color='#FFFFFF'>Could not connect to MySQL</font>".mysql_error());
$selection=mysql_select_db("efiling")
or die("<font color='#FFFFFF'>Unable to select database.</font>".mysql_error());
$sql2 = "SELECT * from association Where AssociationName='$an'";
$result2 = mysql_query($sql2)
or die("<font color='#FFFFFF'>SQL select statement failed</font>");
if (mysql_num_rows($result2) < 1)
{
$sql = "INSERT INTO association(Index, AssociationName) VALUES ('$id', '$an')";
$result=mysql_query($sql)
or die("<font color='#FFFFFF'>SQL select statement failed</font>");
if ($result)
{
print "<script language ='javascript'>window.alert('Added Succesfully!');window.location.href='AssociationAdd.php'</script>";
}
else
{
die(mysql_error());
}
}
else
{
print"<p align='center'> </p>
<table width='400' height='200' border='1' align='center' bordercolor='#66FF00'bgcolor='#0000FF'>
<td><div align='center'><font color='#FF0000' size='5'><p>The Association Name Has Been Registered, Please Enter Other Association Name</p> </font></div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table> ";
print "<p align='center'> </p>";
echo "<HTML><META HTTP-EQUIV='REFRESH' CONTENT='2; URL=AssociationAdd.php'>
<CENTER><p> </p><p>
<tr>
<td align='center'><h12>please wait...</h12></td>
</tr>
</table><p> </p><p> </p></CENTER></BODY></HTML>";
}
}
?>
</body>
</html>
Anyone can tell me what is the problem and how to solve it?
[edited by: eelixduppy at 3:28 am (utc) on Oct. 6, 2009]
[edit reason] side scroll [/edit]
Get rid of all the font elements, center tags, and the miles of non-breaking spaces and do the job properly.
You have spaces in URLs. That is always a very bad idea.
There's a lot more at stake than is suggested by your original question.
[edited by: g1smd at 9:48 pm (utc) on Oct. 5, 2009]
So you need to change lines 19 and 20 of AssociationAddProcess.php to:
$id = $_GET["T2"];
$an = $_GET["T1"];
Hope this helps. BTW, i'd suggest you name your buttons something other than "submit". In Javascript, all forms have a function called submit() that you may want to use in the future, and a button called "submit" overrides this function. You may want to give unique names to those submit buttons, i like using "op_add" and "op_back" etc:
echo"<p> <input type='submit' value=' Add ' name='op_add' ...
echo"<input type='reset' value=' Reset ' name='B2' ...
echo"<input type='submit' value=' Back ' name='op_back'...
Then in your PHP script you can simply check for isset($_POST['op_add']) and isset($_POST['op_back']).
if (mysql_num_rows($result2) < 1)
{
$sql = "INSERT INTO association(Index, AssociationName) VALUES ('$id', '$an')";
$result=mysql_query($sql)
or die("<font color='#FFFFFF'>SQL select statement failed</font>");
But I checked my database, there is no wrong typing I think. May I know what is the problem? Below is print screen of my databse.
[img127.imageshack.us...]
There are quite a few of them. To avoid this kind of problem, i usually try to use field and table names containing an underscore.
Notice: Undefined index: T1 in c:\easyphp1-8\www\efiling\associationaddprocess.php on line 20"
<html>
<head>
<meta http-equiv="Content-Language" content="ja">
<title>Index</title>
</head>
<div style="position: absolute; width: 1146px; height: 842px; z-index: 1; left:10px; top:1px" id="layer2" align="center">
<body background="E-Filing%20Management%20System%20Picture/Snow.gif">
<p align="center">
<img border="0" src="E-Filing%20Management%20System%20Picture/logo-RR-gif.gif" width="957" height="245"></p>
<p align="center"><span lang="zh-cn"> </span></p>
<p align="center"><span lang="zh-cn"><img border="0" src="E-Filing%20Management%20System%20Picture/Association.gif" width="491" height="74"></span></p>
<p align="center"><span lang="zh-cn"> </span></p>
<div style="position: absolute; width: 191px; height: 28px; z-index: 2; left: 546px; top: 441px" id="layer4">
<font color="#FFFFFF"><span lang="en-us">
<font size="4" face="Arial Rounded MT Bold"> Association Name</font></span></font></div>
<div style="position: absolute; width: 70px; height: 24px; z-index: 1; left: 298px; top: 442px" id="layer3">
<font size="4" face="Arial Rounded MT Bold"><font color="#FFFFFF"><span lang="en-us">
Index</span></font></font></div>
<p align="center"><span lang="zh-cn">
</span><font color="#FFFFFF"><span lang="en-us">
<font face="Arial Rounded MT Bold"> </font>
<font size="4" face="Arial Rounded MT Bold"> </font></span></font></p>
<p align="center"><span lang="en-us"> </span>
<?php
echo"<form method='POST' action='AssociationAdd.php'>";
echo"<input type='text' name='T2' size='11'> ";
echo"<input type='text' name='T1' size='77'></p>";
echo"<p> <input type='submit' value=' Add ' name='submit' style='font-family: Times New Roman; color: #000000; font-weight: bold; font-size: 12pt'> ";
echo"<input type='reset' value=' Reset ' name='B2' style='font-family: Times New Roman; color: #000000; font-weight: bold; font-size: 12pt'> ";
echo"<input type='submit' value=' Back ' name='submit' style='font-family: Times New Roman; color: #000000; font-weight: bold; font-size: 12pt'></p>";
if(isset($_POST["submit"]))
{
$submit = $_POST["submit"];
$T1 = $_POST["T1"];
$T2= $_POST["T2"];
if($submit==" Add ")
{
print "<script language ='javascript'>window.location.href='AssociationAddProcess.php?T1=$T1&T2=$T2'</script>";
}
else if($submit==" Back ")
{
print "<script language ='javascript'>window.location.href='Association.php'</script>";
}
}
echo"</form>";
?>
</div>
</body>
</html>
This is the second page(AssociationAddProcess.php):
<html>
<head>
<meta http-equiv="Content-Language" content="ja">
<title>Index</title>
</head>
<body background="E-Filing%20Management%20System%20Picture/Snow.gif">
<p align="center">
<img border="0" src="E-Filing%20Management%20System%20Picture/logo-RR-gif.gif" width="957" height="245"></p>
<p align="center"><span lang="zh-cn"> </span></p>
<p align="center"><span lang="zh-cn"><img border="0" src="E-Filing%20Management%20System%20Picture/Association.gif" width="491" height="74"></span></p>
<?php
$id = $_POST["T2"];
$an = $_POST["T1"];
if ($id==null¦¦$an==null)
{
print"
<p align='center'> </p>
<table width='400' height='200' border='1' align='center' bordercolor='#66FF00'bgcolor='#0000FF'>
<td><div align='center'><font color='#FF0000' size='5'><p>Please Enter Index and Association Name Completely</p> </font></div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table> ";
print "<p align='center'> </p>";
echo "<HTML><META HTTP-EQUIV='REFRESH' CONTENT='2; URL=AssociationAdd.php'>
<CENTER><p> </p><p>
<tr>
<td align='center'><h12>please wait...</h12></td>
</tr>
</table><p> </p><p> </p></CENTER></BODY></HTML>";
}
else
{
$connection=mysql_connect("localhost","root","")
or die("<font color='#FFFFFF'>Could not connect to MySQL</font>".mysql_error());
$selection=mysql_select_db("efiling")
or die("<font color='#FFFFFF'>Unable to select database.</font>".mysql_error());
$sql2 = "SELECT * from association Where AssociationName='$an'";
$result2 = mysql_query($sql2)
or die("<font color='#FFFFFF'>SQL select statement failed</font>");
if (mysql_num_rows($result2) < 1)
{
$sql = "INSERT INTO association(Index, AssociationName) VALUES ('$id', '$an')";
$result=mysql_query($sql)
or die("<font color='#FFFFFF'>SQL select statement failed</font>");
if ($result)
{
print "<script language ='javascript'>window.alert('Added Succesfully!');window.location.href='AssociationAdd.php'</script>";
}
else
{
die(mysql_error());
}
}
else
{
print"<p align='center'> </p>
<table width='400' height='200' border='1' align='center' bordercolor='#66F tube34.net F00'bgcolor='#0000FF'>
<td><div align='center'><font color='#FF0000' size='5'><p>The Association Name Has Been Registered, Please Enter Other Association Name</p> </font></div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table> ";
print "<p align='center'> </p>";
echo "<HTML><META HTTP-EQUIV='REFRESH' CONTENT='2; URL=AssociationAdd.php'>
<CENTER><p> </p><p>
<tr>
<td align='center'><h12>please wait...</h12></td>
</tr>
</table><p> </p><p> </p></CENTER></BODY></HTML>";
}
}
?>
</body>
</html>
Anyone can tell me what is the problem and how to solve it?
:)
print "<script language ='javascript'>window.location.href='AssociationAddProcess.php?T1=$T1&T2=$T2'</script>";
Basically your script is saying that there is no varaible $t2 because your if(isset must not have returned true. I hope this helps.