php form sanitation before sending to external url -
i have form on site gets submitted third party site adds form data record in third party database. implemented form "action" attribute. have no control on third party after form submitted. see below implementation.
i'm doing javascript validation, need able server-side sanitation , validation of form data php before gets sent third party. may want implement captcha.
what approach can take achieve this? thought having form submit script houses form, , collecting of $_post variables, validation, , maybe redirect third party url, not quite sure how third party receive form data if not longer form action. possible tack of form variables on query string third party url?
<form id="contactform" name="contactform" onsubmit="return validateform(this)" method="post" enctype="multipart/form-data" action="https://thirdpartysite.com/db/?action=addrecord&apptoken=xxx"> <input class="contactfield required contact_name_first" type="text" id="firstname" name="firstname" placeholder="first name" /> <input class="contactfield required contact_name_last" type="text" id="lastname" name="lastname" placeholder="last name" /> <input class="contactfield required contact_org" type="text" id="organization" name="organization" placeholder="organization" /> <input class="contactfield required contact_email" type="text" id="email" name="email" placeholder="email" /> <input class="contactfield required contact_phone" type="text" id="phone" name="phone" placeholder="phone" /> <textarea class="contactfield required contact_msg" id="message" name="message" cols="40" rows="10" placeholder="how can you?"></textarea> <input type="hidden" name="rdr" value="http://www.mysite.com/thank-you" /><!-- note: gets passed third party site page redirect after third party site receives form data" --> </form>
Comments
Post a Comment