Jump to content

Recommended Posts

I'm submitting a form to an external site.  The page where I post on the external site processes the form values.  I don't have access to the external site, so I have no control of it.

 

I need to validate the form data using PHP before I post to this external site.  I have figured out how to validate the form in PHP, so that's not a problem.

 

My problem is: how do I then post the form to the external site once the validation is all clear?  If I put the external site in the action="externalsite.com" then my PHP server-script validation is skipped. 

 

I don't have a DB back-end or cUrl installed, so for now can't use either and I'm looking for another solution.

 

I am stuck so any help would be greatly appreciated. 

Link to comment
https://forums.phpfreaks.com/topic/156058-need-help-with-form/
Share on other sites

yes you can. have that submit page submit to a different page (maybbe sanitize.php)

 

have that page take the variables, and populate a form with however many hidden fields that you need, and then submit the form with javascript IE

$var = $_POST['my+var'];
//sanitize here

?>
<form action="what_ever.ext" method="post" name="MyForm">
       <input type="hidden" name="hiddenfield1" value="<? echo $var; ?>">
     </form>
     
     <script language="javascript" type="text/javascript">
    document.MyForm.submit();
     </script>
     <noscript><input type="submit" value="verify submit"></noscript>

 

Hope that helps!

 

Link to comment
https://forums.phpfreaks.com/topic/156058-need-help-with-form/#findComment-821579
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.