Jump to content

Auto form submit via php?


jerel

Recommended Posts

Hello,

 

My issue is that rather than pass a bunch of variables from one page to the next via a header() command I would like to post them via a form, but automatically submit, all the values will be passed, just an auto submit, the action i guess to just skip hitting the submit button?

 

I know the below are only snippets of code, but i think it better illustrates my point. It's not hard what i'm trying to do, i just don't know how to do it.

 

This would make my life much much easier

 

thanks

 

rather than this

 

page 1

 

header("Location: http://www.thepage.php?somevars=$vars");

 

page 2

 

$_REQUEST["vars"];

 

 

I would like to do something like

 

page 1

echo "<form name="form1" method="post" action="page 2">

        <input type="hidden" name="vars" value="$vars" >

        <input type="??????AUTO?????submit" name="Submit" value="Submit">

        </form>

        ";

 

page 2

 

$_POST["vars"];

 

Link to comment
https://forums.phpfreaks.com/topic/70775-auto-form-submit-via-php/
Share on other sites

You could even save them in session vars and not even have to send them out and get them back!

I'm not really sure what your asking though when it comes to the submit button, why would you make that automatic, when, once filled? If so then you need to use javascript that checks for a completed form whenever a form element loses focus!

Hello,

 

with the submit button, it's because i only know how to pass variables a few ways

 

1 is request

2 is post

3 is write them to a db and pull them

 

as this is all user submitted info to traverse many a database, i now have the project almost completed and as there is no critical info being passed, it isn't a big deal.

 

More than anything i'm problaby just overcomplicating what otherwise is a simple issue.

 

As far as the session thing, i'm not familiar.

 

Thanks!

Archived

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

×
×
  • Create New...

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.