Jump to content

Archived

This topic is now archived and is closed to further replies.

judeddokoinu

Redirect with form - possible?

Recommended Posts

I'll do my best to explain this, forgive me if it is confusing.

I have a remote server which contains a page of ever-changing data. On this page are HTML forms next to each entry on the page (about 20 are shown, if I remember correctly) Each HTML form is just a simple:

[code]
<form method="POST" action="http://foo.com/view.php?id=342452346">
     <input type="hidden" name="password" value="yourpass">
     <input type="submit" name="submit" value="submit">
</form>
[/code]

So, I mirrored this page using a fopen() call to the URL. The reason I'm mirroring is that I want it to auto-refresh, which I can do on my own server via PHP. ALL OF THAT IS DONE, by the way. The page works fine.

***What I'm wanting to do now is have the ability for the user(me) to enter a search term, and if one of the entries on the screen contains that term, then tell the browser to submit the form and load the next page.***

Entering the search term is simple. I can get that setup and into a variable, and I can even flag when it finds it.

What I DON'T know is how I can "submit" the form - possibly using a redirect, but how do I get the form's fields into the URL to redirect to? Isn't a hidden field not shown in the URL?

Share this post


Link to post
Share on other sites
If you want to submit your form data over the URL then change your method attribute in your form to GET then any thing you submit via the form will places in the URL instead in this format:
www.example.com?password=yourpass&submit=submit

password and submit are you form elements and any think after the equals sign is the value.

Share this post


Link to post
Share on other sites
you need java script to post the form fields.
simply write the java script function with container the following
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
function submitform(){
frm.submit();
}
[/quote]

and at the end of you php script call the java script function.

[quote]

Share this post


Link to post
Share on other sites
The problem with changing post to get is that the remote server uses the post vars, and not get vars. I don't have the options of changing the remote server's code.

The JS option would work, but it seems that the entire page would have to load, then be examined by JS, and then the form could be submitted. I would like it to be silent - invisible... Basically:

[code]
1. Get listing
2. Parse into variables
3. If variable == search term
    a. submit form
    b. halt
4. Show listings
5. Refresh
[/code]

I've got all of it completed except for 3a

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.