hi it is me again, this is my assignemet been trying to fix this php script for a long time

first to begin, it was issuing an error,

Warning: join(): Invalid arguments passed in C
this is the first error

and the second error was: notice: undefined index in c.
apprently if my html code, i had register a the values when registering but in my php code i had enter instead, so i fix it right

now after i finished fixing it, i tried to register a user and now i am getting a blank page, dont know what is the cause but maybe a third eye can see what I cant. please help
here is what i have tried.



            //capture the variable from the form and store in php variables
            $service= join(", ", $_POST['services']);


            //Query the database
            $sql="SELECT * FROM members WHERE username='$username'";

            $result= mysqli_query($conn, $sql) or die ("ERROR:" .mysqli_error($conn));


            //checking to see if username is already exist
            if($rowcount >= 1) 
                 echo "<script type=\"text/javascript\">
                      alert('Username already exits');

                //insert data into table

                $sql = "INSERT INTO members
                VALUES('$title', '$firstname', '$lastname', '$username', '$email', '$gender', '$service', '$address', md5('$mypwd'))";


                    echo "<script type=\"text/javascript\">
                      alert('Welcome!! $firstname $lastname, you are now a member of the Caribbean Nature Seekers Institute TT(CNSITT)');

                    echo "Error inserting values into database";

                //end of line



I'd worry more about the sql injection that you've opened yourself up to. Either sanitize or use a prepared statement. Sorry can't examine your code further at the mo other than you must validate all your user input data. The services data seems to be the wrong data type. Are you sure it is an array? If not you can cast it as one. However your html form should do this e.g. Multiple instances of name="services[]"

I’m on my phone so I can’t type much but blank pages are due to php fatal errors. Typically these are syntax errors, calling functions/methods that don’t exist, etc.

You can set php logging to print out fatal errors instead of just a blank page. I don’t remember the syntax off the top of my head.

In my observatin the most common reason for a blank page is that the script is missing a character. If you left out a ' or } or ; somewhere, your PHP won't work. You don't get an error; you just get a blank screen.