Case :
Hi all, actually i use POST and GET method in many times and they're work fine. But this time it isn't. I use POST TYPE form and then do PHP While (Looping) to generate some HTML attribute, i also give name to these HTML attribute (like input field etc). But second script (different page name), just won't detect it. It's like im using 1.php (where POST method applied) and 2.php (where GET method applied).
Experiment :
My experiment with code is like this basically (just to show logic, not the actual code).
1.php
<?php
echo <form method="POST" action="2.php">
while (fetch) {
echo fetch
}
echo </form>
?>
2.php
<?php
$x = $GET['id'] // work fine
$x = $GET['html_attribute'] // result : unidentified index
$query = update tbl_transaction set x='$x' where id='$id'
$query -> execute();
?>
Real Code of 2.php
<?php
include 'config/user_session.php';
include 'config/config.php';
if(isset($_GET['id']))
{
$id=$_GET['id'];
$no_ref=$_GET['no_ref'];
$desc=$_GET['desc'];
$amount=$_GET['amount'];
$via=$_GET['slPayment'];
$date=$_GET['date'];
$cat=$_GET['cat'];
$subcat=$_GET['subcat'];
$query1=mysql_query("update tbl_transaksi set no_ref='$no_ref', desc='$desc', amount='$amount', via='$via', date='$date', cat='$cat', subcat='$cat' where id='$id'");
if($query1)
{
echo '<script language="javascript">';
echo 'alert("Transaction Edited.")';
echo '</script>';
echo "<script>setTimeout(\"location.href = 'edit_transaction.php';\",100 </script>";
}
}
?>
I tried to change GET with POST, the result still same. Unidentified Index.
Desired Output :
I want 2.php GET Function return value from 1.php attribute value. Form method already POST.
Where did i do wrong ? What code i should modify ?
Thank you Stackoverflow Community.