Jump to content

IFRAME question


murfitUK

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

Archived

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

×
×
  • Create New...