This form works on other pages, but not current one

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
davidprogramer
Forum Commoner
Posts: 64
Joined: Mon Nov 28, 2005 6:11 pm

This form works on other pages, but not current one

Post by davidprogramer »

Code: Select all

$sql_ladders = sql_query("SELECT ladder_id, ladder_name	FROM ".$prefix."_league_ladders");

<form name=\"form1\" method=\"post\">
		Ladder: &nbsp<select name=\"menuJoinLadder\">";
	for ($m=1; $m < sql_num_rows($sql_ladders)+1; $m++)
	{
		list($ladder_id, $ladder_name) = sql_fetch_row($sql_ladders);
		echo "<option value=\"modules.php?name=League&file=join_ladder&lid=$m\">$ladder_name</option>";
	}
		echo "</select>&nbsp
		<input type=button name=ButtonGO value=Go onClick=\"MM_jumpMenuGo('menuJoinLadder','parent',0)\">
	</form>

I didn't modify the code at all on this page and it simply will NOT submit or change the page on this page. I don't understand why the go button will not work when it is clicked. Any help? I can post more code if asked to but this really is the main part of it. The combo box is populated correctly, but the go button just wont work.
Last edited by davidprogramer on Tue Feb 28, 2006 9:21 pm, edited 1 time in total.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

try

1) Setting a form action
2) Your missing a slash .. look carefully ;)


<form name="form1\" method=\"post\">


Also,

Are you defining the javascript function in your second page?
MM_jumpMenuGo()
davidprogramer
Forum Commoner
Posts: 64
Joined: Mon Nov 28, 2005 6:11 pm

Post by davidprogramer »

Yeah. Btw, the slash was on it in my script..I don't know why it isn't there..odd.


Here is the code from the FIRST page that WORKS:

Code: Select all

<?php
$index = 1;
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
if (!defined('MODULE_FILE')) {
   die ("You can't access this file directly...");
}
opentable();
include("modules/League/includes/league_header.php");
require_once("modules/League/includes/league_functions.php");

$current_user = $cookie[0];

$sql_ladders = sql_query("SELECT ladder_id, ladder_name	FROM ".$prefix."_league_ladders");
echo "<center><font size=3><b>Clan Headquarters</b></font><br><br>";
	
echo "<center>
<table>
	<form name=\"form1\" method=\"post\">
		Ladder: &nbsp<select name=\"menuClanHQ\">";
	for ($m=1; $m < sql_num_rows($sql_ladders)+1; $m++)
	{
		list($ladder_id, $ladder_name) = sql_fetch_row($sql_ladders);
		echo "<option value=\"modules.php?name=League&file=clan_hq&op=load&view=roster&lid=$ladder_id\">$ladder_name</option>";
	}
		echo "</select>&nbsp
		<input type=\"button\" name=\"Button1\" value=\"Go\" onClick=\"MM_jumpMenuGo('menuClanHQ','parent',0)\">
	</form>
</table>
</center><br>";
Here is the code from the SECOND page that DOES NOT WORK:

Code: Select all

<html><title>All Out War : Join Ladder</title></html>
<?php
$index = 1;
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
include("header.php");
if (!defined('MODULE_FILE')) {
   die ("You can't access this file directly...");
}
opentable();
include("modules/League/includes/league_header.php");
require_once("modules/League/includes/league_functions.php");

$current_ladder = $_GET[lid];

$sql_ladders = sql_query("SELECT ladder_id, ladder_name	FROM ".$prefix."_league_ladders");

echo "<center>
<table>
	<form name=\"form1\" method=\"post\">
		Ladder: &nbsp<select name=\"menuJoinLadder\">";
	for ($m=1; $m < sql_num_rows($sql_ladders)+1; $m++)
	{
		list($ladder_id, $ladder_name) = sql_fetch_row($sql_ladders);
		echo "<option value=\"modules.php?name=League&file=join_ladder&lid=$m\">$ladder_name</option>";
	}
		echo "</select>&nbsp
		<input type=button name=ButtonGO value=Go onClick=\"MM_jumpMenuGo('menuJoinLadder','parent',0)\">
	</form>
</table>
</center><br>";
if ($current_ladder > 0){

edit: I just figured the problem out. header.php contains a piece of code somewhere that is allowing working it. I am betting that the function mmjumpmenugo is in header.php.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

I am betting that the function mmjumpmenugo is in header.php.
your bet is the same as mine
davidprogramer
Forum Commoner
Posts: 64
Joined: Mon Nov 28, 2005 6:11 pm

Post by davidprogramer »

It was a custom function that I made and I totally forgot about it. lol. It's fixed now. Sometimes all it takes is a little code comparing with something that works. :lol: Thanks :)
Post Reply