I am building an auction website in php. I have calculated remaining time till an auction is live. The remaining time is calculated as $remaning = $date - time();
where $date
is the last date till auction of a product is live and it is fetched from the database using mysqli as shown below
<?php
if ($stmts = $mysqli->prepare('SELECT end_date FROM products WHERE pid = ?')) {
$stmts->bind_param("i",$pid);
$stmts->execute(); // Execute the prepared query.
$stmts->bind_result($endDate); // get variables from result.
$stmts->fetch();
$stmts->close();
$date = strtotime($endDate);
$remaning = $date - time();
}
?>
I am accepting bidding amount through a text box in my page as shown below.
<form ...> <!-- Form to submit bidding amount starts here -->
<input type="text" placeholder = "Bid Price" name="bid_price" id="bid_price" title="Enter your Bid for auction" required />
<input type="submit" class="sbmt" name="bidsubmit" id="bidsubmit" value="Submit"/>
</form> <!-- Form ends here -->
How can I make that text box having id bid_price disabled or hide it after remaining time is over, so that no user can bid after that.