Jump to content

IFRAME question


murfitUK
 Share

Recommended Posts

Never really used iframes before so not quite sure I'm doing.Right - I've got an iframe<iframe id="name" src="textfile.html" width=... height=... etc></iframe>This is fine if I want to display the contents of an existing file (in this example textfile.html), but is it possible to generate the required content without having a file?What I would like to do is a straightforward <form action....> with a text field called message. Then get the message using $message=$_POST['message'] in the usual way, and then put that text into the iframe.Can it be done? Thanks.

Link to comment
Share on other sites

Not with iFrames, unless you're using sessions.You can "simulate" the iFrame with div tags: Let's guess we have a page called messages.php

<form action="messages.php" method="post">Message:<textarea name="message"></textarea><br><input type="submit" value="Submit Message"></form><?if (isset($_POST['message'])){	echo "<div style=\"width:[any number]px; height:[any number]px; overflow:auto\">"	.$_POST['message'].	"</div>";}?>

The div tag generates a scroll if the message is more than the defined width and height; which, I think, is what you're looking for with the iFrame

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...