Jump to content

PHP Form automatically submit


Lectrician

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

Thanks,

 

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 thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.