Jump to content


Redirect with form - possible?

  • Please log in to reply
3 replies to this topic

#1 judeddokoinu

  • Members
  • PipPip
  • Member
  • 19 posts

Posted 14 April 2006 - 02:23 PM

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:

<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">

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?

#2 wildteen88

  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 14 April 2006 - 03:47 PM

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:

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

#3 arifsor

  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts
  • LocationPakistan

Posted 14 April 2006 - 03:48 PM

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(){

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

Power Demand Respect
Arif Sorathia

#4 judeddokoinu

  • Members
  • PipPip
  • Member
  • 19 posts

Posted 14 April 2006 - 04:01 PM

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:

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

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

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users