Ways to output $_POST key => value

<?php
echo implode(‘, ‘, array_keys($_POST));
echo implode(‘, ‘, array_values($_POST));
echo ‘<br>’;
$post1 = array_keys($_POST);
$post2 = array_values($_POST);
foreach($_POST as $key=>$value)
{
echo “$key=$value”.”<br>”;
}
var_dump($post1,$post2);
?>

Use case:

 

<?php
include (‘escapeData.php’);
$updateFields = array();
if (isset($_POST[“tableName”]) && !empty($_POST[“tableName”])) {
if (!isset($_POST[‘tableName’])){
$errormsg = “tableName is missing!”;
}
$tableName = $_POST[‘tableName’];
$UpdateSql = “UPDATE `$tableName` SET “;
unset($_POST[‘tableName’]);
foreach($_POST as $key=>$value){
$key = escapeData($link,$key);
$value = escapeData($link,$value);
array_push($updateFields, “$key=’$value'”);
}
$UpdateSql .= implode(‘, ‘, $updateFields);
$UpdateSql .= ” WHERE `forlang`= ‘$adminforlang'”;
//echo $UpdateSql;
mysqli_query($link, $UpdateSql) or $errormsg = “Error! Could not Update database, Error 002.”.mysqli_error($link);
//exit();
}
?>

 

Programming