• Welcome to Valhalla Legends Archive.
 

[PHP Solved] Form

Started by PaiD, November 01, 2005, 04:37 AM

Previous topic - Next topic

PaiD

Ok I cant find out what is wrong with this code of mine and I was hoping someone could spot my problem(s).
echo ("<html>\n");echo ("<title>Enter Username/Password</title>\n");echo ("<p align=\"center\">\n");echo ("<body bgcolor=\"black\">\n");echo ("<img src=\"bot.jpg\">\n");echo ("<form name=\"form1\" method=\"post\" action=\"bot.php\">\n");echo ("<p align=\"center\">\n");echo ("<font color=\"#FFFFFF\">Username:</font>");echo ("<input name=\"User\" type=\"text\" id=\"User\">\n");echo ("<br>\n");echo ("<font color=\"#FFFFFF\">Password:</font>");echo ("<input name=\"Pass\" type=\"text\" id=\"Pass\">\n");echo ("<br>\n");echo ("<input type=\"submit\" name=\"Submit\" value=\"Submit\">\n");echo ("</p>\n");echo ("</form>\n");echo ("</body>\n");echo ("</html>\n");?>

That is the form and when they click Submit I wanted it to go to Bot.php and pass the Post Stuff with it. I cant seem to get it to work right. It keeps going to the Header and being redirected
$User == $_POST["User"];$Pass == $_POST["Pass"];if (!$User) {   header("location: /wb/bot.jpg");   Exit;} else {$IP = $_SERVER['REMOTE_ADDR'];$Connection = @mysql_connect("localhost","Username","Password") or die(mysql_error());$DB = @mysql_select_db("Database Name",$Connection);$SQL = "INSERT INTO `Users` (`Username`,`Password` , `Ip Address`, `Status`)" ."VALUES ('$User', '$Pass', '$IP','0')";@mysql_query($SQL,$Connection) or die(mysql_error());mysql_close($Connection);}break;?>


Edit: Nevermind. Fixed. Not sure how but I was just messing with it and now it works :o

AC_Drkan

Just as a side note, you don't have to separate every html code into a seperate echo statement, it can be included in 1 without the \n.
"The Arguments of Today Result in the Wars of Tomorrow" - Quote By Muah.
<@Logan> I spent a minute looking at my own code by accident.
<@Logan> I was thinking "What the hell is this guy doing?"

<kow`> "There are 10 types of people in the world... those who understand binary and those who don't."
<SpaceRain> That's only 2 types of people, kow.
<SpaceRain> STUPID


<[TN]FBMachine> i got kicked out of barnes and noble once for moving all the bibles into the fiction section

God i love Bash.org.

rabbit

You'll want to changeif (!$User) { to if(!isset($_POST)) {
Grif: Yeah, and the people in the red states are mad because the people in the blue states are mean to them and want them to pay money for roads and schools instead of cool things like NASCAR and shotguns.  Also, there's something about ketchup in there.

FrOzeN

While were posting in a dead and solved topic I might add that you can close the php brackets then use html code and re-open them even during a statement.

Eg,
<?php$var1 = "hello";$var2 = "world";if (($var1 . " " . $var2) == ("hello world")) {?>

<html>
<head>
  <title>Page Title</title>
</head>
<body>
Hello World!
</body>
</html>
<?
} else {
    echo "Didn't work!";
}
?>


I find it comes in handy when using alot of html within php. :)
~ FrOzeN

Warrior

I'd rather not have my HTML code mixed with my PHP. I like to keep them both seperate for easy maintenence in the future.
Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?