Jump to content

[SOLVED] PHP code WHAT DID I DO WRONG??


mkiller

Recommended Posts

hi all,

 

can anybody help me? I'm trying to make a registerscript.

<?php

if (isset($_POST['send'])){

mysql_connect("localhost","****","****");

mysql_select_db(crimebay);

$naam = $_POST['naam'];

$pass = $_POST['pass'];

$pass1 = $_POST['pass1'];

$email = $_POST['email'];

if (empty($naam or $pass or $email or $pass1)) {

echo "one or more fields are not fild";

}

}

else{

echo "wrong, go back";

}

?>

that's the script,

the **** are my name and pass for database

 

but when i run this script it returns blank

 

i have my own webserver

 

Apache2.2

php 5.2.10 <-- i thought it was because that's the newest php.

mysql + phpMyAdmin

 

greets and thanks

Marcel

 

p.s. sorry for my bad English I'm dutch

Link to comment
https://forums.phpfreaks.com/topic/167601-solved-php-code-what-did-i-do-wrong/
Share on other sites

<?php
if(isset($_POST['send']))
{
    mysql_connect("localhost","****","****");
    mysql_select_db('crimebay');
    
    $naam = $_POST['naam'];
    $pass = $_POST['pass'];
    $pass1 = $_POST['pass1'];
    $email = $_POST['email'];
    
    if (empty($naam) || empty($pass) || empty($email) || empty($pass1))
    {
        echo "one or more fields are not fild";
    }
}
else
{
    echo "wrong, go back";
}
?>

 

That do anything?

try the following:

mysql_connect("localhost","****","****") or die("Couldn't make connection.");
mysql_select_db('crimebay'); or die("Couldn't select database.");

    $naam = $_POST['naam'];
    $pass = $_POST['pass'];
    $pass1 = $_POST['pass1'];
    $email = $_POST['email'];

if (strlen($naam) < 1) {
    die ("Invalid.. name Empty");
     }  
     if(strlen($pass) < 1) {
         die ("Invalid.. password Empty");
         }
       if (strlen($pass1) < 1) {
           die ("Invalid.. password confirmation Empty");
           }
          if (strlen($email) < 1) {
              die ("Invalid.. email Empty");
              }

//the code you want to do if all field are filled;

 

 

yes

 

thanks mate it works

i copied youre script over mine

but i forgot to check it, so  the script was now

<?php
<?php
if(isset($_POST['send']))
{
    mysql_connect("localhost","****","****");
    mysql_select_db('crimebay');
    
    $naam = $_POST['naam'];
    $pass = $_POST['pass'];
    $pass1 = $_POST['pass1'];
    $email = $_POST['email'];
    
    if (empty($naam) || empty($pass) || empty($email) || empty($pass1))
    {
        echo "one or more fields are not fild";
    }
}
else
{
    echo "wrong, go back";
}
?>

(look at the <?php)

and now it works thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.