Jump to content

PHP Form automatically submit


Recommended Posts

I am developing some code in PERL as this is what my site runs with.  However, I want to use some PHP code to do some image manipulation.


I have a form created with perl which is submitted to a PHP script.  So far this script is VERY simple!


The script takes the form elements and outouts them into a redirect url (for example www.myurl.com/cgi-bin/script.pl?name=tom;age=20)


I am doing this as I want the submitted form from the perl script to goto the PHP script, run through the script and then redirect back to the perl script with the data.


I would prefer not to place the form element data into the URL in the redirect back to the perl script.


So, my question.......


Can you use perl to automatically submit a form with hidden elements?  I have tried creating a form and using javascript to submit it, but I have trouble getting HTML, PHP and JAVASCRIPT running together!


I am VERY new to PHP!


Any help appreciated.

Link to comment
Share on other sites



Thats what I was thinking of doing with the javascript.  I was trying to use this instead


<form name="myform" method="post" action="recieve.php">
<input type="hidden" name="user" value="$user">
<script language="JavaScript">document.myform.submit();</script></form>


Thing is, the $user variable can only be used in the PHP tags.  It doesn't work in the HTML after the PHP code I have.


Do I need to write the form into the PHP tags using "print"?  When I try this I get parse errors?

Link to comment
Share on other sites

One more thing.....


How can I prevent the PHP scripft from re-running after a page refresh?


My users fill ina form, the data is submitted to the PHP script, the PHP script plays with the data and then sends it back off to a Perl script (where it actually originated from).  The auto submit of the form is doing this.


once my Perl script has finished with the data from the PHP submitted, if a user presses the back button they get the blank PHP page.  If they then refresh this page the data from the initial form is acted on twice (in my case, the same images are uploaded again, and given a different random filename).


I would like to prevent this!


New to PHP, so please be patient with me :-)

Link to comment
Share on other sites


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.