mkiller Posted July 27, 2009 Share Posted July 27, 2009 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 More sharing options...
Prismatic Posted July 27, 2009 Share Posted July 27, 2009 <?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? Link to comment https://forums.phpfreaks.com/topic/167601-solved-php-code-what-did-i-do-wrong/#findComment-883806 Share on other sites More sharing options...
mkiller Posted July 27, 2009 Author Share Posted July 27, 2009 nope thx for fast reply Link to comment https://forums.phpfreaks.com/topic/167601-solved-php-code-what-did-i-do-wrong/#findComment-883815 Share on other sites More sharing options...
wgoldschagg Posted July 27, 2009 Share Posted July 27, 2009 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; Link to comment https://forums.phpfreaks.com/topic/167601-solved-php-code-what-did-i-do-wrong/#findComment-883817 Share on other sites More sharing options...
mkiller Posted July 27, 2009 Author Share Posted July 27, 2009 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 Link to comment https://forums.phpfreaks.com/topic/167601-solved-php-code-what-did-i-do-wrong/#findComment-883820 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.