rommel_toledo Posted May 4, 2004 Share Posted May 4, 2004 HI: In first place, thank everybody . I'm doing again my site Naval9095. So I decide to use DW MX, PHP and MySQL. I made some pages and they work just fine when I test them locally, so I put them up in the server of my site. The problem begins they don't work, I tried to analize the problem, I finded that the "Form Action" in the generate pages is diferent. Here's the original code how it is seen in the Code Editor in DW: <?php require_once('Connections/naval.php'); ?> <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO niveles (Descripcion) VALUES (%s)", GetSQLValueString($_POST['password'], "text")); mysql_select_db($database_naval, $naval); $Result1 = mysql_query($insertSQL, $naval) or die(mysql_error()); $insertGoTo = "DirectorioEmail.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_naval, $naval); $query_niveles = "SELECT * FROM niveles"; $niveles = mysql_query($query_niveles, $naval) or die(mysql_error()); $row_niveles = mysql_fetch_assoc($niveles); $totalRows_niveles = mysql_num_rows($niveles); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form action="<?php echo $editFormAction; ?>" method="POST" name="form1" target="_self"> <p> </p> <p> <input name="password" type="text" id="password"> nivel</p> <p> <input type="submit" name="Submit" value="Submit"> </p> <input type="hidden" name="MM_insert" value="form1"> </form> <?php //phpinfo(); //error_reporting(E_ALL); //print session_encode(); print "<p>Welcome, your session ID is ".session_id()."</p> \n\n"; ?> </body> </html> <?php mysql_free_result($niveles); ?> Here's the code generate in my laptop: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form action="/gene/pruebas.php" method="POST" name="form1" target="_self"> <p> </p> <p> <input name="password" type="text" id="password"> nivel</p> <p> <input type="submit" name="Submit" value="Submit"> </p> <input type="hidden" name="MM_insert" value="form1"> </form> <p>Welcome, your session ID is </p> </body> </html> Here's the code generate in the server: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form action="" method="POST" name="form1" target="_self"> <p> </p> <p> <input name="password" type="text" id="password"> nivel</p> <p> <input type="submit" name="Submit" value="Submit"> </p> <input type="hidden" name="MM_insert" value="form1"> </form> <p>Welcome, your session ID is </p> </body> </html> As you can see the <form action="" in the server generate code is empty. Can anybody help with this??? I'm running PHP 4.3.4 and the server is 4.0.6. Thanks in advance. (Sorry about my english) Quote Link to comment https://forums.phpfreaks.com/topic/1832-problems-using-form-action/ Share on other sites More sharing options...
Pavel_Nedved Posted May 15, 2004 Share Posted May 15, 2004 Just change the following code: <form action="<?php echo $editFormAction; ?>" method="POST" name="form1" target="_self"> to <form action="<?php echo "$editFormAction"; ?>" method="POST" name="form1" target="_self"> Hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/1832-problems-using-form-action/#findComment-6022 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.