4

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

cristi _b
  • 1,783
  • 2
  • 28
  • 43
user1939816
  • 45
  • 1
  • 1
  • 5

1 Answers1

3

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'];

SeanWM
  • 16,789
  • 7
  • 51
  • 83