Reputation: 1315
I'm developing a script that when given some information, will create Filezilla Server users, a folder in my HTDocs folder, and a MySQL user and database.
For some reason, a the variable $mysqlpass stays blank even though I've made certain that the variable is spelled correctly.
I'm checking to see if the user entered in an Input field using empty(). Is this correct, or should I be using isset()?
This is the source
http://pastebin.com/reTtME9S
This is the output for "blahhh" as the Apache folder, with nothing else filled in (besides the MySQL Admin information).You can see in the output that $mysqluser works fine but the password is blank.
http://pastebin.com/Mp2jA5iH
Upvotes: 0
Views: 90
Reputation: 3257
First of all: are you sure that you are passing the variable through the correct POST key "mysqlpass". Just in case, you are not aware, the firebug plugin for Firefox is very good for this (just open up the console tab).
Secondly: you can use PHP's var_dump($mysqlpass)
to see exactly what the variable referencing. This will at least give some more information to go on.
Hopefully one of these two methods will help you further troubleshoot this problem.
Also, as stated, you may wish to turn your if/else ladder on line 32 into a series of if statements so they are all accounted for (thus fixing your second problem and "blahhh" example).
Upvotes: 0
Reputation: 4392
It's blank in your 2nd example because you're using elseif
's - meaning that another condition is satisified before it gets a chance to default the password to the username. Break all of those out into individual if
statements and you should be good.
Edit: sorry, should have read better - reexamining. But they should be individual if
s anyway.
Upvotes: 2