tags:

views:

54

answers:

5

Well I have a index.html where i wud like to submit some coordinates that can be passed upon to separate php file ; where it cud perform a a query. I am new to this and so any suggestions wud be really helpful

html:

    Xmax<input type="text" name="Xmax" size="15">
    Ymax<input type="text" name="Ymax" size="15">
    <input type=SUBMIT name="submit" VALUE="Submit">

php query:

$query = "SELECT * FROM state WHERE LONG_HI<$_POST["Ymax"] AND LAT_HI<$_POST["Xmax"];
     $result = mysql_query($query);

So is there a way to perform remote action from this htm to the specified php file??!

A: 

Well, Forms can do the job. Is'nt it?

Shubham
A: 

Yes

Either make an HTML form to accept the Xmax and Ymax parameters, and set the form action to the PHP file;

Or use AJAX to pass the data in the background and receive a response.

If both of these concepts are foreign to you, and you don't know JavaScript, get comfortable with the first option first.

Jhong
well how to set form action to remote php file??!
Imre has that. However if you are serious about this, might I recommend: http://www.w3schools.com/html/
Jhong
A: 

Would you please describe in detail what you are about to do?

  • do you have a html form?
  • What kind of request do you do, clicking a link, sending the form?
  • The query does not contain any of the variables...

could you please post excerpts of the code? single lines are useless in most cases.

Regards, Mario

Mario Mueller
Well I edited my question clearly now.. cud u have a look now!I was trying to send form variables to a remote php file but I am not sure how
A: 

use action attribute in FORM element to specify where the request will be sent to.

<form action="another.php" method="POST">
    Xmax<input type="text" name="Xmax" size="15">
    Ymax<input type="text" name="Ymax" size="15">
    <input type=SUBMIT name="submit" VALUE="Submit">
</form>
Imre L
Either use <a href="http://api.jquery.com/category/ajax/">ajax</a> or place your php code before your html code in index.html and rename that file to index.php. Then you call "index.php" instead of "another.php"
hitautodestruct
Then you can either use AJAX or redirect back to index.html from the another.php calling `header('Location: index.html');` after youre done in there.
Imre L
thanks..i'd give it a try
A: 

Hello, You just add few line with your code because to transfer any variable value from one form to another page we have to use 'form' method. So, we have to add form tag with your code. Transferring of data from one page to another page (any type of page like php, jsp, aspx etc) is done by two methods mainly - one of them is Post and another one is Get. Difference between both the method is quite simple. In Post method, data from one page to another page travels in hidden form where as Get is basically used to transfer value by displaying it at url. Post method example : user-name and password & Get Method - Any query fired at Search Engine.

<form name="form" action="filename.php" method="POST" >
    //Your Code 
</form>

All The Best.

Rahul Patil