Jump to content


New Members
  • Posts

  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

codedman's Achievements


Newbie (1/5)



  1. codedman


    please, what is my mistake here? <?php // This function will run within each post array including multi-dimensional arrays function ExtendedAddslash(&$sql){ foreach($sql as $sql){ // check if $var is an array. If yes, it will start another ExtendedAddslash() function to loop to each key inside. is_array($sql) ? ExtendedAddslash($sql) : $sql=addslashes($sql); } } // Initialize ExtendedAddslash() function for every $_POST variable ExtendedAddslash($_POST); if ($_POST["submit"]==true) echo'you submitted this form'; else{ echo'You are yet to complete your form'; } $fname=$_POST["fname"]; $sname=$_POST["sname"]; $lname=$_POST["lname"]; $dept=$_POST["dept"]; $school=$_POST["school"]; $faculty=$_POST["faculty"]; $level=$_POST["level"]; $email=$_POST["email"]; $course=$_POST["course"]; $psw=$_POST["psw"]; $servername = "localhost:3306"; $username = "admin"; $password = "Ilove081."; $dbname = "school"; // Create connection $conn =mysqli_connect($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } else { echo'<hr/>'; } // Attempt insert query execution $sql = "INSERT INTO register (id,firstname,surname, lastname,department,school,faculty,level, email,course,password,reg_time) VALUES ('',$fname,$sname, $lname,$dept,$school,$faculty,$level, $email,$course,$password,CURRENT_TIME_STAMP)"; if(mysqli_query($conn, $sql)){ echo "Records inserted successfully."; } else{ echo "ERROR: Couldn't upload your data. Please, kindly try again. this is the error message<br/> $sql. " . mysqli_error($conn); } // Close connection mysqli_close($conn); ?> <div> <p align="center"> <h2>Below are the information you submitted;</h2><br/> <ol> <li><em>Firstname:</em> <?php echo $fname?></li> <li><em>Email:</em> <?php echo $email?></li> <li><em>School:</em> <?php echo $school?></li> <li><em>Course:</em> <?php echo $course?></li> </ol> </p> </div> kindly correct me
  • 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.