Reputation: 45
i have a code
<form action="index.php" method="post">
<input type="text" name="jam" />
<input type="submit" name="submit" value="Translate" />
</form>
<?php
$conn = mysql_connect ("localhost", "root","") or die (mysql_error());
mysql_set_charset('utf8',$conn);
mysql_select_db ("movedb");
$jam = $_POST['jam'];
$sql = mysql_query("select * from WORD where ENGLISH like '$jam%' Limit 15");
while ($row = mysql_fetch_array($sql)){
echo ' '.$row['ENGLISH'];
echo ' - '.$row['SINHALA'];
echo '<br/>';
}
?>
i want to post that text value like index.php?=text=(text box value here)
and i want to get that submited to $jam
Upvotes: 4
Views: 21969
Reputation: 16989
Form method should be get
not post
.
Also, remove the >
from your action. Small typo.
Try:
<form action="index.php" method="get">
<input type="text" name="jam" />
<input type="submit" name="submit" value="Translate" />
</form>
Then you can do: $jam = $_GET['jam'];
Upvotes: 3