amir4oracle
Programmer
I need your help, in regards to how to receive values of different variables using $_GET and $_POST in the same form.
I am actually working on a website, in which there is a small form.
The form is getting a value "order_number" from another web page "A" using $_GET method.
The same form has a field "addi_info" in html part which is being sent to the php part of the form using $_POST method.
The web page "A" is sending the order_number cleanly without a problem.
When the submit button is clicked it gives the following error:
Notice: Undefined index: order_number in D:\ on line 2
The code of the form is as follows:
------------------------------------------------------------------------------------------
<?php
if (is_numeric ($_GET['order_number']))
{
if (isset ($_POST['submit']))
{
require_once ('conn_db.php');
$addi_info = $_POST['addi_info'];
$ordr_numb = $_GET['order_number'];
$query = "
insert into addi_info (ordr_numb, addi_info)
values ($ordr_numb, '$addi_info');
";
$result = @mysql_query ($query);
mysql_close ();
}
}
?>
<html>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
<textarea name="addi_info" value="<?php echo $_POST['addi_info']; ?>"></textarea>
<input type="submit" value="Save" name="submit">
</form>
</html>
------------------------------------------------------------------------------------------
So I need your help, in regards to how to receive values of different variables using $_GET and $_POST in the same form.
I am actually working on a website, in which there is a small form.
The form is getting a value "order_number" from another web page "A" using $_GET method.
The same form has a field "addi_info" in html part which is being sent to the php part of the form using $_POST method.
The web page "A" is sending the order_number cleanly without a problem.
When the submit button is clicked it gives the following error:
Notice: Undefined index: order_number in D:\ on line 2
The code of the form is as follows:
------------------------------------------------------------------------------------------
<?php
if (is_numeric ($_GET['order_number']))
{
if (isset ($_POST['submit']))
{
require_once ('conn_db.php');
$addi_info = $_POST['addi_info'];
$ordr_numb = $_GET['order_number'];
$query = "
insert into addi_info (ordr_numb, addi_info)
values ($ordr_numb, '$addi_info');
";
$result = @mysql_query ($query);
mysql_close ();
}
}
?>
<html>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
<textarea name="addi_info" value="<?php echo $_POST['addi_info']; ?>"></textarea>
<input type="submit" value="Save" name="submit">
</form>
</html>
------------------------------------------------------------------------------------------
So I need your help, in regards to how to receive values of different variables using $_GET and $_POST in the same form.