0

I need your super help to end a project. I've a homepage.html that contains a drop down menu generated by different < option >. at the end of the form I have submit button that leads to booking.html page that contains an iframe.

I would need to take the value (number) generated by previous form and put it at the end of the url of the src iframe, so that the iframe changes depending on the previous choice.

and..the src is on a different domain. So the final result would be something like: < iframe src="domain2.com/?=dynamic_number" >

I have no idea how to do that.

Thanks in advance and sorry for my bad English..

endriu
  • 15
  • 1
  • 6
  • 1
    Can you please post the content of your HTML Form and the content of Booking.html? Also... Can you use PHP or ASPX? – JuanBonnett Feb 21 '15 at 23:07
  • 1
    is there any server side code you are using? You can either do it there or use javascript to read the value from the querystring/post data and update the src clientside with js. BTW, your english is fine. – Guy Lowe Feb 21 '15 at 23:10

1 Answers1

1

In case you can use a Server Side script like PHP:

Form:

<form method="post" action="booking.php">
    <select name="myUurlParameter">
    <option value="1"></option>
    <option value="2"></option>
    <option value="3"></option>
    </select>
</form>

Booking.php

<?php
$urlParam = $_POST["myUrlParameter"];
?>
<html>.... ....

<iframe src="http://thewebsite.com/?param=<?php echo $urlParam ?>" ...></iframe>

You can also use Javascript (it's complicated tho) ...

Change the above form method to GET, change the action to your .HTML file (Booking.html)

Inside booking, generate the iframe dinamically using javascript. Read this answer to know how to do it (again, it's complicated... )

How to get the value from the GET parameters?

Community
  • 1
  • 1
JuanBonnett
  • 776
  • 3
  • 8
  • 26