I am creating a user registration form and i want to show a loading/progress on my page as soon user click submit button. Here Is my code please suggest me something to achieve this. here below is process.php file
if(isset($username)){
$con = new dbConnection();
$con->connect();
$con->add_user($username,$email,$password,$contact);
$db_class = 'ui success message';
$db_message_header = 'header';
$db_header_message = 'Your user registration was successful.';
$db_msg= 'You may now log-in with the username you have chosen';
$form_load = 'loading'; //Class for adding loading class
sleep(4);
header('location:index2.php');
}
Here is index.php
<form class="ui form attached fluid segment <?php echo $form_load; ?>" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" id="form">
<div class="field">
<label>Username <span id="err">*</span></label>
<input placeholder="Username Name" type="text" name="username" class="ui input success" value="<?php if(isset($username)){echo $username;} ?>" required>
</div>
<input type="submit" name="submit">Submit</input>
</form>