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

6
  • 2
    Remove > from index.php-> <form action="index.php> in your code Commented Dec 31, 2012 at 15:04
  • Use Get method instead of POST, and i think u too dont want this = sign in ndex.php?=text=(text box value here) its going to be ndex.php?text=(text box value here) Commented Dec 31, 2012 at 15:05
  • url showing as index.php?jam=so&submit=Translate i want to remove &submit=Translate code Commented Dec 31, 2012 at 15:15
  • just use <input type="submit"> then Commented Dec 31, 2012 at 15:18
  • thank.. how can i convert index.php?jam=what urls to .html like /what.html Commented Dec 31, 2012 at 15:26

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

7 Comments

i want to set my text box value to variable and post it with my link. like index.php?id=<my text box value here>
@user1939816 - change name="jame" to name="id" to do so.
the url showing as index.php?jam=so&submit=Translate i want to remove &submit=Translate this
working. thanks .. and i want to convert index.php?jam=what this php url to .html url how to do it
@sean accepted the answer. stackoverflow.com/questions/8562724/php-url-to-html-url by this tutorial how can i change my index.php?jam=what to html ? like index.html?jam=what ?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.