How to send a JSON object to a php from HTMl form



I am tryiong to integrate a XML API solution for Hotel Booking, and i want to use JSON to send onject to php so the system can return me the responses. The form is :



<form action="http://ift.tt/1vTFgYa" method="post">
<label>Destinatie</label>
<input type="text" value="Oras" name="City" id="autocomplete" placeholder="Oras sau regiune" />
<label>Check In</label>
<input type="text" name="In" value="AAAA/LL/ZZ" class="input-text full-width" placeholder="yyyy/mm/dd" />
label>Check Out</label>
<input type="text" name="Out" value="AAAA/LL/ZZ" class="input-text full-width" placeholder="yyyy/mm/dd" />
<label>Camere</label>">
<select name="RoomsNR" class="full-width">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<label>Adulti</label>
<select name="Adults" class="full-width">
<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>
<option value="6">6</option>
</select>
<label>Copii</label>
<select name="Kids" class="full-width">
<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>
</select>
<button type="submit">CAUTA</button>
</form>


For the city, in and out i sent them using post.


And i need to receive the information in php as the below: -And example with 2 rooms selected and 4 adults



// First Room
$rooms[] = array(array("paxType" => "Adult"));

// Second Room
$rooms[] = array(array("paxType" => "Adult"), array("paxType" => "Adult"));


I have tried to send the values using post and create some php rules by its not working as it should. Several people adiced me to do this with JSON, but i have no ideea how to do this. Of helps the Instruction for this API system can be found at : http://ift.tt/1xClNRZ


No comments:

Post a Comment