Forum
24
bd

















1. First of all registration here 2. Then Click on Be a trainer or writer button 3. Collect your trainer or writer id card from trainer master 4. And create post here for earn money! 5. For trainer 100 tk minimum withdraw 6. For writer 500 tk minimum withdraw 7. Payment method Bkash Only
obaydulbc obaydulbc
Trainer

2 years ago
obaydulbc

Php post creator code with post list like as Bootstrap design




Now i am going to share with you. a beautiful PHP post creator code with post list like as bootstrap design..

if you dont know how to use PHP code . please Read our previous post :

PHP prorgam for beginners. How To start with PHP programming,


<?php

// Start session
session_start();

// Set default timezone
date_default_timezone_set('UTC');

// Create an empty array to store posts
$posts = [];

// Check if form is submitted
if (isset($_POST['submit'])) {

// Get form input values
$author = $_SESSION['username'];
$content = $_POST['content'];
$date = date('Y-m-d H:i:s');

// Create new post array
$new_post = [
'author' => $author,
'content' => $content,
'date' => $date,
];

// Add new post to array of posts
array_push($posts, $new_post);
}

?>

<!DOCTYPE html>
<html>
<head>
<title>Post Creator</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>

<div class="container">
<!-- Post Creator Form -->
<form method="post" class="my-4">
<div class="form-group">
<label for="content">Create a post:</label>
<textarea id="content" name="content" rows="4" class="form-control"></textarea>
</div>
<button type="submit" name="submit" class="btn btn-primary">Submit</button>
</form>

<!-- List of Posts -->
<?php foreach ($posts as $post): ?>
<div class="card my-4">
<div class="card-body">
<p class="card-text"><?php echo $post['content']; ?></p>
</div>
<div class="card-footer text-muted">
Posted by <?php echo $post['author']; ?> on <?php echo $post['date']; ?>
</div>
</div>
<?php endforeach; ?>
</div>

<!-- Bootstrap JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>


×

Alert message goes here

Plp file


Category
Utube fair

pixelLab দিয়ে নিজের নাম ডিজাইন ও Mocup

Paid hack

App link topup