Jump to content

Recommended Posts

please, what is my mistake here?



// 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
if ($_POST["submit"]==true)
echo'you submitted this form';
    echo'You are yet to complete your form';


$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 {

// 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

    <p align="center">
        <h2>Below are the information you submitted;</h2><br/>
        <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>


kindly correct me 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.