
Originally Posted by
Kalon
hint: from your posted link code
Code:
<FORM ACTION="DBaction3-3.php" method="post">
<input type="text" name="myVar" value="title1">
<input type="submit">
</form>
The link above " http://dot.kr/x-test/todbAction3-3.php " has the code below.
Code:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>dbAction3-3</title>
</head>
<body>
<FORM ACTION="DBaction3-3.php" method="post">
<input type="text" name="myVar" value="title1">
<input type="submit">
</form>
</body>
</html>
The result says "select id from myTable1 where title='' " instead of "select id from myTable1 where title='title1' "
I don't know what's wrong with it.
Code:
dbAction3-3
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>dbAction3-3</title>
</head>
<body>
<?php
$con = mysql_connect("localhost","*******","*******");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
mysql_query("SET NAMES utf8");
$query="select id from myTable1 where title='".$_post['$myVar']."' " ;
echo $query;
mysql_close($con);
?>
</body>
</html>
And I have myTable1 in "test" like the following.
Code:
data in myTable1
(id) title
1 title1
2 title2
Bookmarks