...

View Full Version : Submit button no effect



Ge64
12-18-2006, 09:31 AM
Index2.php:

<form method="POST" action="index2.php">
<tr>
<td colspan="2">Login:</td>

</tr>
<tr>
<td width="250">Username:</td>
<td width="166"><input type="text" name="user"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pass"></td>
</tr>
<tr>
<td>Remember:</td>

<td><input type="checkbox" name="remember"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Register" name="subreg"> <input type="submit" value="Login" name="sublogin"></td>
</tr>
</form>

It does nothing, it also doesn't load the page or anything. Is it supposed to work or am I missing something?

_Aerospace_Eng_
12-18-2006, 10:26 AM
It should post to index2.php

Does that file exist? If so what is it in it?

Ge64
12-18-2006, 10:35 AM
It should post to index2.php

Does that file exist? If so what is it in it?

<?php
if(isset($_POST['sublogin'])) { echo 'boo'; }
?>

The button does nothing, it doesnt even load index2.php or anything. I also tried just 'echo "boo";' but nothing happens at all.

_Aerospace_Eng_
12-18-2006, 10:48 AM
Well you have two submit buttons. I just tested what you have on my local server, pressing the first submit button does nothing because the second submit button is never actually clicked however using the second submit button echos boo.

Ge64
12-18-2006, 11:27 AM
Well you have two submit buttons. I just tested what you have on my local server, pressing the first submit button does nothing because the second submit button is never actually clicked however using the second submit button echos boo.

Then maybe it's something else somehow, because I click both buttons and nothing happens at all. I'll re-check what I have

CFMaBiSmAd
12-18-2006, 04:02 PM
I tested and this works (both submit buttons.)

Your first post lists the form code as index2.php and you also posted the second piece of code as index2.php, which file is really named index2.php?

Ge64
12-19-2006, 02:01 AM
This is the entire output of index.php:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" language="javascript">
var loggedin = 0
window.onload = function()
{
if (loggedin) {
document.getElementById('login').innerHTML = document.getElementById('logged_in').innerHTML;
} else {
document.getElementById('login').innerHTML = document.getElementById('login_form').innerHTML;
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>

<table width="250" border="1" cellspacing="0" cellpadding="0">
<tr>
<td id="login"></td>

</tr>
<tr>
<td id="body">~*body*</td>
</tr>
<tr>
<td><div id="login_form" style="display: none;">
<table width="422" border="1" cellspacing="0" cellpadding="0"><form method="POST" action="index2.php">
<tr>
<td colspan="2">Login:</td>

</tr>
<tr>
<td width="250">Username:</td>
<td width="166"><input type="text" name="user"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pass"></td>
</tr>
<tr>
<td>Remember:</td>

<td><input type="checkbox" name="remember"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Register" name="subreg"> <input type="submit" value="Login" name="sublogin"></td>
</tr>
</form></table></div><div id="logged_in" style="display:none;"><p>Logged in as: ~*loggedin_name*</p></div>
<a href="?action=logout">Log out</a></td>
</tr>
</table>

</body>

</html>

This is index2.php:


<?php
error_reporting(E_ALL);
session_start();
include 'config.php';
include 'functions.php';
connectdb();
if (isset($_GET['action'])) { include 'actions.php'; }
include 'login.php';

if(isset($_POST['sublogin'])) { echo 'boo'; login(); }

$test1 = "test1";
$test2 = "test2";
$test3 = "test3";

$variable_list = array(
'login_form_properties',
'login_usernameinput_properties',
'login_passwordinput_properties',
'login_rememberinput_properties',
'login_loginbutton_properties',
'login_registerbutton_properties',
'loggedin_name',
'loggedin',

'test1',
'test2',
'test3');

for ($i = 0;$i <= (count($variable_list)-1);$i++) {
$currentarraykey = '~*' . $variable_list[$i] . '*';
if (isset(${$variable_list[$i]})) {
$injectdata[$currentarraykey] = ${$variable_list[$i]};
}
}

mysql_close($conn);

echo inject($injectdata,"default");

?>

You see, pressing the login button should at least echo boo somewhere, but instead nothing happens. It doesn't even go to index2.php or anything at all.

Edit: :confused: I just tried IE6 and it does boo, but in FFv2 nothing happens?!

Edit2: I decided to run the output through the html validator, and the problem was the <form> tag cannot be inside the <table> tag. So I switched them and now it works :P



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum