| | |
How to POST the data to second page?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Apr 2008
Posts: 29
Reputation:
Solved Threads: 0
This is the first page of my website(AssociationAdd.php). When I clicked the 'Add' button, it shows that :
"Notice: Undefined index: T2 in c:\easyphp1-8\www\efiling\associationaddprocess.php on line 19
Notice: Undefined index: T1 in c:\easyphp1-8\www\efiling\associationaddprocess.php on line 20"
This is the second page(AssociationAddProcess.php):
Anyone can tell me what is the problem and how to solve it?
"Notice: Undefined index: T2 in c:\easyphp1-8\www\efiling\associationaddprocess.php on line 19
Notice: Undefined index: T1 in c:\easyphp1-8\www\efiling\associationaddprocess.php on line 20"
PHP Syntax (Toggle Plain Text)
<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):
PHP Syntax (Toggle Plain Text)
<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?
Notices are not errors. If you try to use a variable without initializing it, you will get a notice. To disable notices, edit your php.ini and set error_reporting as,
This will show all the errors except notices.
But, if you want fix these notices, initialize every variable to null or 0 before using it.
•
•
•
•
error_reporting = E_ALL & ~E_NOTICE
But, if you want fix these notices, initialize every variable to null or 0 before using it.
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Apr 2008
Posts: 29
Reputation:
Solved Threads: 0
•
•
•
•
Notices are not errors. If you try to use a variable without initializing it, you will get a notice. To disable notices, edit your php.ini and set error_reporting as,
This will show all the errors except notices.
But, if you want fix these notices, initialize every variable to null or 0 before using it.
•
•
Join Date: Apr 2008
Posts: 29
Reputation:
Solved Threads: 0
•
•
•
•
What did you change ? php.ini or your script ?
If you are talking bout php.ini, did you restart your server ?
Just now I didn't restart, now I restart already. It does not have the error already. But it still connect to "Please Enter Index and Association Name Completely" although I typed the index and name.
What does "error_reporting = E_ALL & ~E_NOTICE" means?
Last edited by kira4; Oct 5th, 2009 at 10:06 am.
•
•
•
•
Is that all of the error_reporting need to change to "error_reporting = E_ALL & ~E_NOTICE"?
Just now I didn't restart, now I restart already. It does not have the error already. But it still connect to "Please Enter Index and Association Name Completely" although I typed the index and name.
•
•
•
•
What does "error_reporting = E_ALL & ~E_NOTICE" means?
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
Also, it isn't necessary to echo out the forms...It's a lot easier to directly include them outside the PHP tags.
I'd also try to use better variable naming.
Why all the nonbreaking spaces? (
If you REALLY need a space, try using CSS to provide that. (
It's also easier to redirect using head outputs, unless the form processing code isn't at the top of the document. I'd suggest putting the form processing code at the top, so you could simply do a
You don't have to echo out code from if's, instead just close php like:
Or using keywords:
Most of this stuff makes the code easier to read, and less prone to blatant errors.
I'd also try to use better variable naming.
Why all the nonbreaking spaces? (
).If you REALLY need a space, try using CSS to provide that. (
<div style="width:200px; height:200px; position:relative"></div> )It's also easier to redirect using head outputs, unless the form processing code isn't at the top of the document. I'd suggest putting the form processing code at the top, so you could simply do a
header('Location: myloc.php'); .You don't have to echo out code from if's, instead just close php like:
php Syntax (Toggle Plain Text)
<?php if ($submit == true){ ?> Thanks for you submission! <?php } else { ?> There were errors in your form. <?php } ?>
php Syntax (Toggle Plain Text)
<?php if ($submit == true): ?> Thanks for you submission! <?php endif; ?>
Last edited by codejoust; Oct 5th, 2009 at 1:34 pm. Reason: A similey was put in the code... forgot to add icode tags.
CodeJoust! Design + Development - Proud User of Ubuntu
![]() |
Similar Threads
- pass data to next page (PHP)
- POSTing data to web page (Python)
- Using urllib2 to post data (Python)
- Button to send POST data (JavaScript / DHTML / AJAX)
- POST data issue when return to page (PHP)
- Simple question: Popup page to post data to mother page (PHP)
- i want to post data with screen scrap page.. (ASP.NET)
Other Threads in the PHP Forum
- Previous Thread: Dynamic Photo Galley or Slide Show
- Next Thread: String Help
| Thread Tools | Search this Thread |
.htaccess alerts apache api archive array autocomplete beginner binary broken cakephp checkbox class cms code convert cron curl database dataentry date display duplicates dynamic echo email emptydisplayvalue error execute explodefunction file files firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include insert ip javasciptvalidation javascript joomla keywords limit link login mail matching menu methods mlm multiple mysql network object oop paypal pdf php problem query radio random recursion recursive redirect remote script search securephp server sessions shot sms source space sql subscription syntax system table tutorial tutorials update upload url validator variable video web youtube







