469,934 Members | 2,607 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

first time to use MySQL on MS Platform with PHP.

Dear my friends...

I am trying to develop a database application with PHP
Version 4.3.2, MS Window 2000, MySQL 4.0.13-nt and
Apache 2.

I tried to insert a record onto my MySQL but I got
this error messages. What do I have to defined to
overcome this problem?
"
Notice: Undefined variable: productid in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: itemname in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: description in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: price in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: information in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
16
Saved successfully
"

Here is the code of productsave.php :
"
<?php
include("functions.php");

$sql="
insert into product ( productid, itemname,
description, price, information )
values ('$productid', '$itemname', '$description',
'$price', '$information')
";
$conn=connection();
choosedb();
if (mysql_query($sql,$conn)){
echo "Saved successfully<br>";
}
else echo mysql_error();

mysql_close($conn);
?>
"

Here is the code of the form which calls
productsave.php (it's cgi program):
"
<form action="cgi/productsave.php" method="POST">
<center><b><u>Data Entry - Product
List</u></b></center>
<br>
<table align="center" border="0">
<tr><td align="left">1.</td><td align="left">Product
ID</td><td align="left" >:</td>
<td align="left" ><input type="text" name="productid"
readonly="yes"></td></tr>
<tr><td align="left">2.</td><td align="left">Item
Name</td><td align="left">:</td>
<td align="left"><input type="text"
name="itemname"></td></tr>
<tr><td align="left">3.</td><td
align="left">Description</td><td align="left">:</td>
<td align="left"><input type="text"
name="description"></td></tr>
<tr><td align="left" >4.</td><td
align="left">Price</td><td align="left">:</td>
<td align="left"><input type="text"
name="price"></td></tr>
<tr><td align="left">5.</td><td
align="left">Information</td><td align="left">:</td>
<td align="left"><input type="text"
name="information"></td></tr>
<tr><td colspan="4" align="center"><input
type="submit" value="Save" src="img/ok.png">
<input type="reset" value="Clear"
src="img/no.png"></td></tr>
</table>
</form>
"

Please tell me. Thank you very much in advance.

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
2 1744
Either use
extract ($_POST);
before your query or

use $_POST["productid"] to access the productid variable (and similar
construction for other varaibles POSTed from the form)

For further information:
http://uk.php.net/variables.external

"Prabu Subroto" <pr**********@yahoo.com> wrote in message
news:bf***********@FreeBSD.csie.NCTU.edu.tw...
Dear my friends...

I am trying to develop a database application with PHP
Version 4.3.2, MS Window 2000, MySQL 4.0.13-nt and
Apache 2.

I tried to insert a record onto my MySQL but I got
this error messages. What do I have to defined to
overcome this problem?
"
Notice: Undefined variable: productid in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: itemname in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: description in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: price in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: information in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
16
Saved successfully
"

Here is the code of productsave.php :
"
<?php
include("functions.php");

$sql="
insert into product ( productid, itemname,
description, price, information )
values ('$productid', '$itemname', '$description',
'$price', '$information')
";
$conn=connection();
choosedb();
if (mysql_query($sql,$conn)){
echo "Saved successfully<br>";
}
else echo mysql_error();

mysql_close($conn);
?>
"

Here is the code of the form which calls
productsave.php (it's cgi program):
"
<form action="cgi/productsave.php" method="POST">
<center><b><u>Data Entry - Product
List</u></b></center>
<br>
<table align="center" border="0">
<tr><td align="left">1.</td><td align="left">Product
ID</td><td align="left" >:</td>
<td align="left" ><input type="text" name="productid"
readonly="yes"></td></tr>
<tr><td align="left">2.</td><td align="left">Item
Name</td><td align="left">:</td>
<td align="left"><input type="text"
name="itemname"></td></tr>
<tr><td align="left">3.</td><td
align="left">Description</td><td align="left">:</td>
<td align="left"><input type="text"
name="description"></td></tr>
<tr><td align="left" >4.</td><td
align="left">Price</td><td align="left">:</td>
<td align="left"><input type="text"
name="price"></td></tr>
<tr><td align="left">5.</td><td
align="left">Information</td><td align="left">:</td>
<td align="left"><input type="text"
name="information"></td></tr>
<tr><td colspan="4" align="center"><input
type="submit" value="Save" src="img/ok.png">
<input type="reset" value="Clear"
src="img/no.png"></td></tr>
</table>
</form>
"

Please tell me. Thank you very much in advance.

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #2
Either use
extract ($_POST);
before your query or

use $_POST["productid"] to access the productid variable (and similar
construction for other varaibles POSTed from the form)

For further information:
http://uk.php.net/variables.external

"Prabu Subroto" <pr**********@yahoo.com> wrote in message
news:bf***********@FreeBSD.csie.NCTU.edu.tw...
Dear my friends...

I am trying to develop a database application with PHP
Version 4.3.2, MS Window 2000, MySQL 4.0.13-nt and
Apache 2.

I tried to insert a record onto my MySQL but I got
this error messages. What do I have to defined to
overcome this problem?
"
Notice: Undefined variable: productid in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: itemname in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: description in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: price in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
15

Notice: Undefined variable: information in
C:\Programme\Apache
Group\Apache2\htdocs\amt\cgi\productsave.php on line
16
Saved successfully
"

Here is the code of productsave.php :
"
<?php
include("functions.php");

$sql="
insert into product ( productid, itemname,
description, price, information )
values ('$productid', '$itemname', '$description',
'$price', '$information')
";
$conn=connection();
choosedb();
if (mysql_query($sql,$conn)){
echo "Saved successfully<br>";
}
else echo mysql_error();

mysql_close($conn);
?>
"

Here is the code of the form which calls
productsave.php (it's cgi program):
"
<form action="cgi/productsave.php" method="POST">
<center><b><u>Data Entry - Product
List</u></b></center>
<br>
<table align="center" border="0">
<tr><td align="left">1.</td><td align="left">Product
ID</td><td align="left" >:</td>
<td align="left" ><input type="text" name="productid"
readonly="yes"></td></tr>
<tr><td align="left">2.</td><td align="left">Item
Name</td><td align="left">:</td>
<td align="left"><input type="text"
name="itemname"></td></tr>
<tr><td align="left">3.</td><td
align="left">Description</td><td align="left">:</td>
<td align="left"><input type="text"
name="description"></td></tr>
<tr><td align="left" >4.</td><td
align="left">Price</td><td align="left">:</td>
<td align="left"><input type="text"
name="price"></td></tr>
<tr><td align="left">5.</td><td
align="left">Information</td><td align="left">:</td>
<td align="left"><input type="text"
name="information"></td></tr>
<tr><td colspan="4" align="center"><input
type="submit" value="Save" src="img/ok.png">
<input type="reset" value="Clear"
src="img/no.png"></td></tr>
</table>
</form>
"

Please tell me. Thank you very much in advance.

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by John | last post: by
3 posts views Thread by Abby | last post: by
4 posts views Thread by Ben | last post: by
reply views Thread by Dragonphoenix | last post: by
6 posts views Thread by Geoff Cox | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.