Insert session variable into MySQL database

<?php
 
    session_start();
    if(!isset($_SESSION['Username'])){
         header("Location: login.php");
    }  
?> 
 
$eventname=$_POST['eventname'];
$Username = $_SESSION['Username']

$sql = mysql_query("INSERT INTO tbl_name VALUES('','$eventname','{$_SESSION['Username']}')");

echo "You have been added to the event";

Comments

Popular posts from this blog

Real-Time Web Interface to MQTT using Socket.io and Node.js

Insert CheckBox and Radio button Data in MySQL Database Using PHP