Dynamic URL in iframe using PHP

Discussion in 'PHP' started by imwebdev, Dec 8, 2008.

  1. #1
    Hi everyone,
    I am having an issue display a page in an Iframe.

    I have a form that I need to submit, and the result needs to appear in an iframe on a thank you page within my website.

    The reason the result has to be in an Iframe is because the result is sent to an external website, and I need to display the output. If I let the page direct to the page without an iframe, it will be a new window with only a few lines of text and a few images.

    I have managed to extract the form URL string that I would like to send to the iframe, the problem is I dont know how to send the string.

    I am guessing I need to send the code the to iframe src=??? but not sure how to do this.

    My URL string looks something like this:
    "$submiturl?url=$sUrl&fn=$sFirstName&ln=$sLastName&add=$sAddress&city=$sCity&state=$sState&zip=$sZipCode";

    Now how do I write this URL string to the iframe?
    Any ideas would be appreciated!

    Thanks
     
    imwebdev, Dec 8, 2008 IP
  2. rene7705

    rene7705 Peon

    Messages:
    233
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <iframe src="$URLstring"> should do fine i think
     
    rene7705, Dec 8, 2008 IP
  3. crivion

    crivion Notable Member

    Messages:
    1,669
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    210
    Digital Goods:
    3
    #3
    when u src, try passing the vars to iframe like this
    <iframe src="youriframe.php?url=$sUrl&fn=$sFirstName&ln=$sLastName&add=$sAddress&city=$sCity&state=$sState&zip=$sZipCode">
     
    crivion, Dec 9, 2008 IP
  4. imwebdev

    imwebdev Peon

    Messages:
    65
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi There Thanks for the replies!
    I managed to figure it out.

    I put the string into a variable i.e. $URLstring like rene7705 said.
    Then in the iframe I passed the variable like this:
    <iframe src="<?php print $URLstring ?>" </iframe>

    Thanks
     
    imwebdev, Dec 10, 2008 IP