Forum Moderators: open
This is the code I have for the form chunk:
<form action="https://externalsite.com/default.asp" name="bookahotel" method="post" class="bookahotelform" target="_blank" >
<input onfocus="this.value = ''; this.onfocus = function () {}" name="_Date" size="6" type="text" value="DD/MM/YYYY" />
<a href="javascript:showCal('Calendar1')"><img src="/images/datepicker.gif" alt="Date picker"></a>
<select name="_Country" size="1">
<option value="GB" selected>United Kingdom</option>
<option value="US">USA</option>
</select>
<input onfocus="this.value = ''; this.onfocus = function () {}" name="towncity" size="12" value="Town/City" type="text" />
<select name="_EnquiryType" size="1" >
<option>No. of nights</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
</select>
<input name="bookahotel_search" value="" type="image" src="/images/bookahotel_search.gif" class="noborder" />
<p class="text_normalblue"><a href="https://externalsite.com/default.asp" title=Advanced search" target="_blank">Advanced search</a> ¦ <a href="#" title="Member login">Member login</a></p>
</form>
So it's just a basic form really, but somehow I need the values inputted into it to be transferred to the ASP page on the external site- can this be done? Basically the external page contains a similar form, what we want is for that form to be pre-filled with the information from the initial (internal) form when the user clicks the Submit button.
Also the internal form is on a Linux server running PHP (not that I'm guessing that makes any difference).
Of course, you do need to make sure your form uses the fields the externalsite.com script is expecting.
It is possible the externalsite.com script has been programmed to only accept form submits from its own domain. The easiest way to find out whether your form will work with their script is to try it and see... :)
somehow I need the values inputted into it to be transferred to the ASP page on the external site ... the external page contains a similar form, what we want is for that form to be pre-filled with the information from the initial (internal) form when the user clicks the Submit button.
If I get this correctly,
Your site -> fill out form, submit
External site -> another form and you hope to populate this form.
No this is not what will happen. Additionally if it did, it will force the user to submit it twice.
If you "post" from your site to the external site's form action (i.e., default.asp) it will never touch the external site's form, "default.asp" will process it as if it were submitted from their site - unless, as mentioned, it will only accept form submissions from their site.
The only way this could possibly "work" is if the form processor on their site (default.asp) is set up to populate the form with default values if there is a problem, such as an error. For example, if I submit a form without an email address, the processor should return to the form with a warning, but all my submitted values would remain intact in the form. So let's say you submit this form with one field missing, it **should** return to the form with all your submitted values present except the missing one.
If this happens, it will appear to "work." Also it may very well be that being it's not submitted from their server, it may do exactly that- return to the form with all your submitted values in it. So it may "appear" to work, but it's only doing so by error, not intent. :-)
In any case the first scenario would be best - submit to their default.asp from your server and it accepts the data, only one "click" for the user.