Blazer
Blazer

Reputation: 316

Iframe source to be a dynamic URL

Not using iFrames very often so I could really do with your help here...

I have a form on a webpage which opens an external online booking engine with availability depending on the dates selected in the form.

I'd like to open the external booking page in an iframe named "mainframe" on a new page, book.html.

The start and end code for the form is:

Code:

  <form name="roseform" method="post" action="http://www.hotelexec.co.uk/external.asp"></form>
  <input type="text" class="dimmed" placeholder="Brasil" id="keywords" name="keywords" />
  <a href="#" class="btn" onclick="submit()">Search</a>

How would I set the target to "mainframe" at the book.html page so the results from the form would be displayed there? I understand I need to make Iframe source to be a dynamic URL.

Thanks,

Blazer

Upvotes: 0

Views: 866

Answers (1)

Narek
Narek

Reputation: 3823

Just add target attribute.

<form name="roseform" target="mainframe" method="post" action="http://www.hotelexec.co.uk/external.asp"></form>

UPDATE

As I understood you need this steps:

For start change .html to .php

Change action of form in itmjobs.ro/lidl/page1.php to point page2.html

<form name="roseform" method="post" action="http://itmjobs.ro/lidl/page2.php"></form>

In page2.php add iframe with address http://itmjobs.ro/search-results-jobs/

<iframe src="http://itmjobs.ro/search-results-jobs/?<?php echo http_build_query($_POST)?>"></iframe>

Now you will see data from http://itmjobs.ro/search-results-jobs/ in your iframe.

Upvotes: 2

Related Questions