Jump to content

Quick to the point quesion Newbie help


claudfs

Recommended Posts

OK i'l make it simple

i got an html page

___________________________________________________________

<html>

 

<body>

  <iframe src="http://example.com"

  height="100" width="200" frameborder="0" scrolling="no">

</iframe>

</body>

</html>

 

-------------------------------------------------------------------

 

No what i would like is to make the iframe src = $variable

 

and that variable is equal to what ever i input in this form

_______________________________________________________________

 

<form action="index.php" method="post">

 

New Website: <input type="text" name="web">

 

<br>

 

<input type="Submit">

</form>

__________________________________________________________________

 

So what i would basically like is that i can goto this input form type a website in and click submit

 

and then that becomes the variable for the iframe , until when ever i submit a new website?

 

Know what i mean

 

how can i do this please

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/77923-quick-to-the-point-quesion-newbie-help/
Share on other sites

With your form statement your using the 'POST' method, so to get the named elements you'd use something like:

$src = "http://example.com";
if (isset($_POST['web']))
{
   $src = $_POST['web'];
}

...

echo "<iframe src='".$src."' height='100' width='200' frameborder='0' scrolling='no'></iframe>";

...

or something like, depending upon your style...

ok, Thanks, but not exactly what i wanted. Basically i want my iframe src to be set to a variable  ($variable)  and it fetches the variable from the .html or .php file  and when ever i want to change the variable i goto a input form and submit the new variable

 

so for example people goto www.example.com  and my fixed variable for the iframe is google

and it displays an iframe of google.

 

But now i want to change it so i got my input form www.example.com/input and i enter a new website facebook.com

 

so now when people goto www.example.com the iframe is facebook and not google.

 

you know what i mean?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.