nvidia Posted March 15, 2007 Share Posted March 15, 2007 Hi i have a html form called connect.html where i enter my username and password. I then click the submit button and if i am successful it will go to my handler1.php file which will displays User [w1009048] successfully connected table is a page to my table.php pagef . When they click on the word table(link to table.php) i am running a select statment against my database: connect.html <html> <head> <title> Connecting To A Database </title> </head> <body> <form action="handler1.php" method="POST"> Your username: <input type="text" name="txtun" /><br> Your password: <input type="password" name="txtpw"/> <br> <input type="submit" name="GO" /> </form> </body> </html> handler1.php <?php // get variables from form $un = $_POST['txtun']; $pw = $_POST['txtpw']; $db = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = squirrel.wmin.ac.uk) (PORT = 1521)) (CONNECT_DATA = (SID = ORA8) (SERVER = DEDICATED)))'; // establish connection if($c= OCILogon($un, $pw, $db) ) { print "User [$un] successfully connected <br> "; OCIlogoff($c); } else { Exit("Error: Could not connect to Oracle"); } ?> <a href="table.php"> table</a> is a page to my table.php page table.php <?php require('handler1.php'); print "Your connections is: [$c] <br/>"; $query = "SELECT * from student"; $stmt = OCIParse($c, $query); ?> After clicking the table link i get the following error messages: Notice: Undefined index: txtun in /home/eland/u1/kbccs/w1009048/public_html/RAD/Examples/handler1.php on line 5 Notice: Undefined index: txtpw in /home/eland/u1/kbccs/w1009048/public_html/RAD/Examples/handler1.php on line 6 Warning: ocilogon(): OCISessionBegin: Error while trying to retrieve text for error ORA-01017 in /home/eland/u1/kbccs/w1009048/public_html/RAD/Examples/handler1.php on line 15 Error: Could not connect to Oracle Can someone please tell me what i need to do please because the two variables it is refering to i.e txtun + txtpw have already been declared?? Link to comment https://forums.phpfreaks.com/topic/42908-running-my-select-query-database/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.