Code: Select all
<?php
session_start();
$username2=$_SESSION['username'];
require('layout.php');
if (is_array($_POST['data2'])) {
$media_array2 = $_POST['data2'];
$checkbox_values2 = ''.implode(',', $media_array2).'';
echo $checkbox_values2;}
// php code -> 1bestcsharp.blogspot.com
// php insert data to mysql database using PDO
if(isset($_POST['submit']))
{
// get values form input text and number
$id = trim($_GET['id']);
$data = date('m/d/Y');
$target = "images/";
$fileName = $_FILES['Filename']['name'];
$fileTarget = $target.$fileName;
$tempFileName = $_FILES["Filename"]["tmp_name"];
$fileDescription = $_POST['Description'];
$result = move_uploaded_file($tempFileName,$fileTarget);
$media_array = $_POST['data'];
$checkbox_values = ''.implode(',', $media_array).'';
$descriere = $_POST['description'];
/*
Code: Select all
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "INSERT INTO report (location,probleme,descriere,data,username,zone)
VALUES ('$id', '$checkbox_values','$descriere','$data','$username2','$checkbox_values2')";
echo $sql;