Jump to content

Form submition help


adamriley

Recommended Posts

Hi could someone say why its not working

 

index1.php (used to check username & password & id)

<?php
$name = $_POST['name'];
$pass = $_POST['pass'];
$id = $_POST['id'];
if ($name == '4' && $pass =='5' && $id == '6'){ ?>
<html>
<body>
<h1>admin</h1>
</body>
</html>
<?php }elseif ($name == '1' && $pass =='2' && $id == '3'){ ?>
<html>
<body>
<h1>user:nathan</h1>
</body>
</html>
<?php }else{ /* OPEN PHP FOR THE ELSE THEN CLOSE IT FOR HTML AGAIN */ ?>
<html>
<body>
<center><h1>wrong password or user</h1></center>
</body>
</html>

<?php } // OPEN PHP AGAIN FOR THE CLOSING BRACE?>

--------------------------------------------------------------------------------------------------

index.php (Used to enter the username and password )

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Untitled Page</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="bv_Form1" style="position:absolute;left:198px;top:102px;width:467px;height:200px;z-index:3;" align="left">
<form name="Form1" method="POST" action="index1.php" id="Form1">
<input type="submit" id="Button1" name="Button1" value="Submit" style="position:absolute;left:127px;top:159px;width:75px;height:24px;font-family:Arial;font-size:13px;z-index:0">
<input type="text" id="Editbox2" style="position:absolute;left:7px;top:77px;width:395px;font-family:Courier New;font-size:16px;z-index:1" name="pass" value="">
<input type="text" id="Editbox3" style="position:absolute;left:8px;top:113px;width:396px;font-family:Courier New;font-size:16px;z-index:2" name="id" value="">

</form>
</div>
<input type="text" id="Editbox1" style="position:absolute;left:202px;top:147px;width:399px;font-family:Courier New;font-size:16px;z-index:4" name="name" value="">
<div id="bv_Text1" style="position:absolute;left:309px;top:25px;width:305px;height:32px;z-index:5;" align="left">
<font style="font-size:27px" color="#000000" face="Arial"><b>  </b></font><font style="font-size:27px;background-color:#0000FF" color="#FF0000" face="Arial"><b><u>Shot factory login</u></b></font></div>
</body>
</html>

-----------------------------------------------------------------------------------------------

error log ||[Mon Jan 25 18:20:42 2010] [error] [client 127.0.0.1] PHP Notice:  Undefined index:  name in C:\\web\\htdocs\\factory\\index1.php on line 2, referer: http://localhost/factory/||

-----------------------------------------------------------------------------------------

Link to comment
https://forums.phpfreaks.com/topic/189758-form-submition-help/
Share on other sites

we'll need more information than that. an undefined index in itself will not lead to the failure of your script - notices from PHP are simply errors pointing out poor coding practices, rather than any sort of fatal or halting error.

 

what happens when you submit the form? how is it "not working?"

Link to comment
https://forums.phpfreaks.com/topic/189758-form-submition-help/#findComment-1001409
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.