Help using PHP Request for posting Form to Iframe
-
Hi there, firstly any help is much appreciated. In very new to php but love wordpress!
I have searched the web everywhere for a simple solution to my issue but struggled to find a working answer.
In short, i have a form on homepage that allows entry of arrival date, departure date and number of guests. i need the form to post these parameters to an booking system provided by a third party BUT hosted on my website via an iframe – but another page, not the homepage where the form is – MUST EMPHASIZE THAT).
Anyway, i’m almost there! but I am struggling to work out the PHP to display a string of php request functions.
Firstly, my current implementation is showing this code on the page source code (NOTE: iframe delibrately spelt wrong to embed here)
<iBrame name="testframe" src="https://externalurl?siteId=KAYSCLAY&request_locale=en&chainAction=newAvailabilitySearch&29/11/201330/11/201312"></ibrame>
The url aspect of the iframe needs to be as follows:
https://externalurl?siteId=KAYSCLAY&request_locale=en&chainAction=newAvailabilitySearch&arrival=09%2F07%2F2013&departure=10%2F07%2F2013&numberOfPersons=1&numberOfChildren=0
So I have two problems. I am only showing two dates combined together in my iframe src string, these need to be seperated, and I am also missing two paramters for some uknown reason – number of people parameters.
Below is my code hardcoded on the iframe php page (html/php) and also my form. Any thoughts, help is much appreciated.
<ibrame name="testframe" src="https://externalurl?siteId=KAYSCLAY&request_locale=en&chainAction=newAvailabilitySearch<?php echo ''.$_REQUEST['arrival'].$_REQUEST['departure'].$_REQUEST['numberOfPersons'].$_REQUEST['numberOfChildren']?>"></ibrame>
<form action="/gatehouse-hotel/book-online/" method="get" name="pageform" onsubmit="return validate(this);" target="testframe"> <div class="FormField Arrival"> <label for="arrival">Arrival Date</label> <input id="arrival" name="arrival" type="text" /></div> <div class="FormField Departure"> <label for="departure">Departure Date</label> <input id="departure" name="departure" type="text" /></div> <div class="FormField NumberOfPersons"> <label for="numberOfPersons">Adults</label> <select id="numberOfPersons" name="numberOfPersons"><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select></div> <div class="FormField NumberOfChildren"> <label for="numberOfChildren">Children</label> <select id="numberOfChildren" name="numberOfChildren"><option value="0">0</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select></div> <div class="FormField Submit"> <input type="submit" value="Book now" /></div> </form> <script language="JavaScript"> function validate(theform) { if (theform.domain.value == "") { alert("No domain entered"); return false; } return true; } </script>
- The topic ‘Help using PHP Request for posting Form to Iframe’ is closed to new replies.