Apache and PHP POST Variable

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Apache and PHP POST Variable

Postby shutout5591 » 17. August 2006 18:47

I created a simple form to use to install a script I made on my localhost's mysql server. When I run the script the variables from the form aren't forewarded to the php script. Here are the two scripts stripped down.:

The Form: installform.html
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Install Login</title>
<style type="text/css">
<!--
.style1 {
   font-size: 36px;
   color: #FF0000;
}
.style2 {
   font-size: 36;
   color: #FF0000;
}
-->
</style>
</head>

<body>
<div align="center" class="style1">Install Login!</div>
<form method="post" action="install.php">
<p>Database Username <input name="db_user" type="text" value="root" />
<input type="submit" name="sumbit" value="Install" />
</form>
</body>
</html>


Here is the php scirpt: install.php
Code: Select all
<html>
<head>
<title>Install Login!</title>
</head>
<body>
<?

echo "Database User = $db_user<Br>";

?>
</body>
</html>


When I run the form and click sumbit, the php script says $db_user has no value

Thanks for your time...
shutout5591
 
Posts: 6
Joined: 02. April 2006 16:47

Postby Wiedmann » 17. August 2006 19:17

Reread your thread subject:
Apache and PHP POST Variable


And now your code:
Code: Select all
echo "Database User = $db_user<Br>";


Why don't you use the variable from the thread subject?
Code: Select all
echo "Database User = $_POST['db_user']<Br>";


BTW:
Please read the PHP manual about "external variables".
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 41 guests