Jump to content

[SOLVED] Auto appending of white spaces on submit.


oceans

Recommended Posts

Please run, this it is interesting, a block of 10 spaces are always added each time I press submit, have taken all precautions, but could not see catch.

 

<?php
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
</head>
<body>
<?PHP
$NumberOfTxtBoxes=1;
$NumberOfTxtBoxesMustBeFilled=1;
$MaxLengthTxtBox=200;
//Transfer Data from Screen to Memory
if (isset($_POST['Submit'])) 
{
for ($i=1; $i<=$NumberOfTxtBoxes; $i++)
{
	$InputFromScreen[$i]=strip_tags(rtrim(ltrim(strtoupper($_POST["Txt".$i]))));
}
}
else
{
for ($i=1; $i<=$NumberOfTxtBoxes; $i++)
{
	$InputFromScreen[$i]="";
}
}
?>
<form id="form1" name="form1" method="post" action="exampltextbox.php">
  <table width="300" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td><span class="FieldValue">
<textarea name="Txt1" cols="70" rows="5" class="FieldValue" id="Txt1"><?PHP echo $InputFromScreen[1]; ?>
          </textarea>
      <input onclick="return count()" name="Submit" type="submit" class="FeildButton" id="Submit" value="Submit" />
      </span></td>
    </tr>
    <tr>
      <td><span class="PHPRunTime">
        <?PHP
//Checking for Unfilled Fields
$TxtBoxesNotFullyFilled=0;
for ($i=1; $i<=$NumberOfTxtBoxesMustBeFilled; $i++)
{
if ($InputFromScreen[$i]=="")
{
	$TxtBoxesNotFullyFilled=1;
	break;	
}
}	
if ($TxtBoxesNotFullyFilled==1)
{
echo "All RED Fields Should be Filled!";
}
else
{
//Check Max Length Of Description Property
if (strlen($InputFromScreen[1])<=$MaxLengthTxtBox)
{
}
else
{
	echo "Your Description is " . strlen($InputFromScreen[1]) . " Characters long, Maximum Allowed is " . $MaxLengthTxtBox . "!";
}
}	
?>
      </span></td>
    </tr>
  </table>
</form>
</body>
</html>


insted of

 

<textarea name="Txt1" cols="70" rows="5" class="FieldValue" id="Txt1"><?PHP echo $InputFromScreen[1]; ?>

          </textarea>

 

 

Keep

 

<textarea name="Txt1" cols="70" rows="5" class="FieldValue" id="Txt1"><?PHP echo $InputFromScreen[1]; ?></textarea>

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.