Jump to content

Writing echo statements to div element


jbond

Recommended Posts

:confused:

Hello everyone,

I am trying to redirect the output of echo statements to a fixed place on the screen. For this I created a div element (called display) and inside the do loop I am echoing the output to the div. However, every line gets overwritten by the next one, rather then scrolling down the window. Is this at all possible?

Below is the code that does the echoing to the div element

function verzend_multi($nummers,$tekstsms) {
$nummer=explode(";",$nummers);
$lus=count($nummer);
for ($loop=0;$loop<$lus;$loop++) {
	$gsmnummer = "32" . substr($nummer[$loop],1,3) . substr($nummer[$loop],4,6);
	if (strlen($gsmnummer) == 11) {
		echo "<div id=display>verzending naar " . $gsmnummer . "<br /></div>";
	} else {
		echo "<div id=display><font color=red>FOUT: Verkeerd geformateerd gsmnummer !! : " . $gsmnummer . "<br /></font></div>";
	}
}
}

 

and this is the css that formats the display div

 

<style type="text/css">

<!--

#display {

border-top-width: thin;

border-right-width: thin;

border-bottom-width: thin;

border-left-width: thin;

border-top-style: double;

border-right-style: double;

border-bottom-style: double;

border-left-style: double;

height: 100px;

top: 350px;

position: absolute;

width: 650px;

overflow: scroll;

display: inline;

}

-->

</style>

 

Has anyone got an idea on how to solve this?

 

Thanks very much

 

 

Link to comment
Share on other sites

do you mean something along these lines

 

$nummer=explode(";",$nummers);

$lus=count($nummer);

<div id="display">;

for ($loop=0;$loop<$lus;$loop++) {

$gsmnummer = "32" . substr($nummer[$loop],1,3) . substr($nummer[$loop],4,6);

if (strlen($gsmnummer) == 11) {

echo "verzending naar " . $gsmnummer . "<br />";

} else {

echo "<font color=red>FOUT: Verkeerd geformateerd gsmnummer !! : " . $gsmnummer . "<br /></font>";

}

}

</div>;

 

because this generates a parse error ...

Link to comment
Share on other sites

Your code has errors in it, displaying HTML out of echo's.

   $nummer = explode(";",$nummers);
   $lus = count($nummer);
   echo '<div id="display">';
   for ($loop=0;$loop<$lus;$loop++) {
      $gsmnummer = "32" . substr($nummer[$loop],1,3) . substr($nummer[$loop],4,6);
      if (strlen($gsmnummer) == 11) {
         echo "verzending naar " . $gsmnummer . "<br />";
      } else {
         echo "<font color=red>FOUT: Verkeerd geformateerd gsmnummer !! : " . $gsmnummer . "<br /></font>";
      }
   }
   echo '</div>';

 

This should work, provided you were wanting it to be within a single div (and not overwritten)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.