I was just tinkering around with phpMyChat and realized that you can only use single-line input. I've sorted through the code looking for a tweak for this, but can't find one. What I'm trying to accomplish is to basically select and copy multiple lines of text from one screen and paste them into the input line where they will be displayed to everyone in the chat. The catch is that I need them to remain in the multiple line format for readability rather than truncated to a single line or merged into a continuous string.

Anyone have any idea how to make this work?

    ive never used it, but my guess is that the input box where you type your messages is a regular text input. change it to <textarea> instead of <input type=text>. then, on the script where the data is POSTed, just put $POST['whateverthefieldnameis'] = nl2br($POST['whateverthefieldnameis']); since i am guessing their chat window is html. i would guess thats all it takes.

      That makes sense, but I'm not sure if it's set up the way you are thinking. Here's a snippet of code from the input.php3 page, where I believe the message handling is done. I know some of this may not make sense to you without seeing all of the other files or the database. Basically, this is just the input form, where I would assume you mean the POST action would be initiated.

      I'm not a PHP programmer by any means, but I do have a little Java and HTML knowledge, so I can follow the code for the most part.

      Part of the confusion in the code I think is due to the PHP wanting to strip all of the HTML tags save for the <B><I> and <U> for on-screen text enhancements. Hopefully, this little bit of code will help make more sense out of it. If not, then maybe I can set up a chatroom on a server somewhere so you can see the whole thing.


      <!-- Input form  -->
      
      <TD>
      <?php
      // Define the way posted values will be handled according to the javascript abilities
      // of the browser
      if ($Ver == "H")
      {
      	$action = "handle_inputH.php3";
      	$target = "input_sent";
      }
      else
      {
      	$action = "input.php3";
      	$target = "_self";
      };
      ?>
      <FORM NAME="MsgForm" ACTION="<?php echo($action); ?>" METHOD="POST" AUTOCOMPLETE="OFF" TARGET="<?php echo($target); ?>" onSubmit="return window.parent.validateSubmission();">
      	<INPUT TYPE="hidden" NAME="From" VALUE="<?php echo($From); ?>">
      	<INPUT TYPE="hidden" NAME="Ver" VALUE="<?php echo($Ver); ?>">
      	<INPUT TYPE="hidden" NAME="L" VALUE="<?php echo($L); ?>">
      	<INPUT TYPE="hidden" NAME="U" VALUE="<?php echo(htmlspecialchars(stripslashes(urlencode($U)))); ?>">
      	<INPUT TYPE="hidden" NAME="R" VALUE="<?php echo(htmlspecialchars(stripslashes(urlencode($R)))); ?>">
      	<INPUT TYPE="hidden" NAME="T" VALUE="<?php echo($T); ?>">
      	<INPUT TYPE="hidden" NAME="D" VALUE="<?php echo($D); ?>">
      	<INPUT TYPE="hidden" NAME="N" VALUE="<?php echo($N); ?>">
      	<INPUT TYPE="hidden" NAME="O" VALUE="<?php echo($O); ?>">
      	<INPUT TYPE="hidden" NAME="ST" VALUE="<?php echo($ST); ?>">
      	<INPUT TYPE="hidden" NAME="NT" VALUE="<?php echo($NT); ?>">
      	<INPUT TYPE="hidden" NAME="PWD_Hash" VALUE="<?php echo(isset($PWD_Hash) ? $PWD_Hash : ''); ?>">
      
      	<!-- Ignored users list -->
      	<INPUT TYPE="hidden" NAME="Ign" VALUE="<?php echo(isset($Ign) ? htmlspecialchars(stripslashes($Ign)) : ""); ?>">
      
      	<!-- Last sent message or command (will be used for the '/!' command) -->
      	<INPUT TYPE="hidden" NAME="M0" VALUE="<?php echo(isset($M) ? htmlspecialchars(stripslashes($M)) : ""); ?>">
      
      	<A HREF="help_popup.php3?<?php echo("L=$L&Ver=$Ver"); ?>" onClick="window.parent.help_popup(); return false" TARGET="_blank" onmouseover="document.images['helpImg'].src = window.parent.imgHelpOn.src" onmouseout="document.images['helpImg'].src = window.parent.imgHelpOff.src"><IMG NAME="helpImg" SRC="images/helpOff.gif" WIDTH=15 HEIGHT=15 BORDER=0 ALT="<?php echo(L_HLP); ?>" onClick="document.forms['MsgForm'].elements['M'].focus();"></A>&nbsp;
      
      	<?php
      	// Get the value to put in the message box : preceding M0 field value for /! command,
      	// preceding entry if it was an erroneous command, else nothing; 
      	$ValM = $IsM ? $M0 : "";
      	if (isset($Error) && !($IsCommand)) $ValM = $M;
      	?>
      	<INPUT TYPE="text" NAME="M" SIZE="50" MAXLENGTH="299" VALUE="<?php echo(htmlspecialchars(stripslashes($ValM))); ?>">
      
      	<!-- Addressee that will be filled when the user click on a nick at the users frame -->
      	<INPUT TYPE="hidden" NAME="MsgTo" VALUE="">
      
      	<?php
      	if ($Ver == "L")
      	{
      		// Drop down list of colors for non-enabled JavaScript1.1+ browsers
      		echo("<SELECT NAME=\"C\">\n");
      		while(list($ColorName, $ColorCode) = each($TextColors))
      		{
      			// Red color is reserved to the admin or a moderator for the current room
      			if ($ColorCode == "#FF0000" && !(isset($status) && ($status == "a" || $status == "m"))) continue;
      			echo("<OPTION VALUE=\"".$ColorCode."\"");
      			if($C == $ColorCode || $ColorCode == "#000000") echo(" SELECTED");
      			echo(">".$ColorName."</OPTION>");
      		}
      		echo("\n</SELECT>&nbsp;\n");
      	}
      	else
      	{
      		?>
      		<INPUT TYPE="hidden" NAME="C" VALUE="<?php echo($C); ?>">
      		<?php
      	}
      	?>
      	<INPUT TYPE="hidden" NAME="sent" VALUE="0">
      	<INPUT TYPE="submit" NAME="sendForm" VALUE="<?php echo(L_OK); ?>">
      </TD>
      
      <?php
      if ($Ver != "L")
      {
      	// Define the colors picker for JavaScript1.1+ enabled browsers 
      	unset($TextColors);
      	$TextColors = array('#000000', '#ffffff');
      	for($x = 0; $x < 360; $x += 6)
      	{
      		$r = ceil(126 * (cos(deg2rad($x)) + 1));
      		$g = ceil(126 * (cos(deg2rad($x + 240)) + 1));
      		$b = ceil(126 * (cos(deg2rad($x + 120)) + 1));
      		if(!($r > 128 && $g < 128 && $b < 128 && !(isset($status) && ($status == "a" || $status == "m"))))
      		{
      			$TextColors[] = '#'.substr('0'.dechex($r), -2).substr('0'.dechex($g), -2).substr('0'.dechex($b), -2);
      		}
      	}
      	?>
      	<TD>&nbsp;&nbsp;</TD>
      	<TD>
      	<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>
      	<TR>
      		<?php
      		while(list($key, $ColorCode) = each($TextColors))
      		{
      			$i = $key + 1;
      			if ($ColorCode == $C)
      			{
      				$wichImage = "selColor.gif";
      				$wichSelected = $i;
      			}
      			else
      			{
      				$wichImage = "unselColor.gif";
      			}
      			echo("\n\t\t\t");
      			echo('<td bgcolor="' . $ColorCode . '"><a href="#" onclick="window.parent.ChangeColor(\'' . $ColorCode . '\',\'C' . $i .'\'); return false;"><img src="images/' . $wichImage . '" alt="' . $ColorCode . '" name="C' . $i . '" border="0" width="2" height="20" /></a></td>');
      		};
      		unset($TextColors);
      		echo("\n");
      		?>
      	</TR>
      	</TABLE>
      	</TD>
      	<TD></FORM></TD>

        the part you will want to change is
        <INPUT TYPE="text" NAME="M" SIZE="50" MAXLENGTH="299" VALUE="<?php echo(htmlspecialchars(stripslashes($ValM))); ?>">

        try
        <textarea name="M" value="<?php echo htmlspecialchars(stripslashes($ValM)); ?>">

        then you will need to look at handle_inputH.php3 and input.php3, since input gets posted to either of those depending on js capability.

        on another note, you should really look at a newer chat program since that is php3 and some stuff in there is deprecated and they are using code that will not work in default configs for newer versions of php.

          You'll have more success with:
          <textarea name="M" cols="50" rows="1"><?php echo htmlspecialchars(stripslashes($ValM)); ?></textarea>

            Write a Reply...