Jump to content

accept post data from form, process, then redirect data to another script


gnznroses

Recommended Posts

I thought this would be fairly easy, but upon sitting down to do it, now I dunno.

i have an html file with a form, and this POSTs data to a PHP script. it's actually a signup form. i want to add another input box to the signup form to get extra info, but the catch is that the PHP file that process the form is encrypted and i can't edit it. so, my idea was: change the html of the form to submit to myform.php, then i'll process the new data field, and re-POST the form to the original file, "encoded.php".

except i'm not sure how to do that or if it's possible... i could use curl of course, but the user needs to be kept down this path of

user fills form -> i process the data -> original php file processes it, checks for invalid info, etc -> user lands on post-signup page, whether it was a success or it's now telling them what info needs corrected.

 

suggestions?

Link to comment
Share on other sites

Write your own version of the encrypted script and add in the extra field?  If you can't/don't want to do that, then you'd have to add a hidden form on the second page (your php page) with hidden fields for each of the fields that need to be passed across to the encrypted file.

Eg:

<form method="POST" action="encrypted.php">
<input type="hidden" name="somevar" value="<?php echo $_POST['somevar'];?>">
<input type="hidden" name="anothervar" value="<?php echo $_POST['anothervar'];?>">
</form>

 

EDIT: Just noticed a problem, the form wouldn't be submitted.  You'd have to have a button that would say "Continue to Register" or something similar.

Link to comment
Share on other sites

ah, i hadn't really thought of using a second page.

i can't really write my own version of the encoded script because i'm not sure of everything it does.

one problem with using a second page (my new form -> my script -> old form), or my original idea either, is that the user's account won't be in the DB yet at the time i process the data. so if i take in my new form input, i can't save that in the db alongside the user account because it hasn't actually been created yet.

 

 

i guess i could use your idea of a second page, instead of interjecting it between the existing form and script, and have a link somewhere, after the user signs up, to my new form. it just may be confusing to the user if an ad says "mention promo code __" and that option isn't on the signup page.

Link to comment
Share on other sites

i don't honestly think it matters. it's just the usual stuff: name, address, etc. it's a signup form. i just want to add one more text input to ask the user something, and then store that info in the db along with their other info (i'll have to add a new field to the existing db table).

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.