Page 1 of 1

Text Box Does Not Display Properly

Posted: Thu Jul 14, 2005 10:17 am
by ut1205
:(Pulling my hair out over this one. I have a text box that echos a variable ($Company). It will only echo a string with no spaces. Obviously a company name has spaces. If I echo "General Motors" all that shows up in the text box is "General" If if were "GeneralMotors" it would echo the entire thing. The echo statments above the text box code will echo the whole string.
What is this newbee doing wrong. Code is below

Code: Select all

<?PHP

$Key = ("".$HTTP_POST_VARS['Key']."");
$Last = ("".$HTTP_POST_VARS['Last']."");
$First = ("".$HTTP_POST_VARS['First']."");
$Company = ("".$HTTP_POST_VARS['Company']."");
$Location = ("".$HTTP_POST_VARS['Location']."");
$Phone = ("".$HTTP_POST_VARS['Phone']."");
$Extension = ("".$HTTP_POST_VARS['Extension']."");
$Cell = ("".$HTTP_POST_VARS['Cell']."");
$Home = ("".$HTTP_POST_VARS['Home']."");
$Pager = ("".$HTTP_POST_VARS['Pager']."");
$Fax = ("".$HTTP_POST_VARS['Fax']."");
$EMail = ("".$HTTP_POST_VARS['EMail']."");


//echo $Key;
echo $Last;
//echo $First;
echo $Company;
//echo $Location;
//echo $Phone;
//echo $Extension;
//echo $Cell;
//echo $Home;
//echo $Pager;
//echo $Fax;
//echo $EMail;

?>
<FORM ACTION='editfinish.php' METHOD='Post'>    

  <div align="center">
  <center>
  <table border="2" cellpadding="0" cellspacing="0" bordercolor="#A00000" width="300" height="98" bgcolor="#FFFFFF">
    <tr>
      <td width="195" height="24" align="center" bordercolor="#A00000"><b>Last Name</b></td>
      <td width="195" height="48" align="center" bordercolor="#A00000"><INPUT TYPE=TEXT Name="Last" value=<?php echo "$Last";?>></td>
    </tr>
    <tr>
      <td width="195" height="24" align="center" bordercolor="#A00000"><b>First Name</b></td>
      <td width="195" height="48" align="center" bordercolor="#A00000"><INPUT TYPE=TEXT Name="First" value=<?php echo $First;?>></td>
    </tr>
    <tr>
      <td width="195" height="25" align="center" bordercolor="#A00000"><b>Company</b></td>
      <td width="195" height="48" align="center" bordercolor="#A00000"><INPUT TYPE=TEXT Name="Company" value=<?php echo $Company;?>></td>
    </tr>

And so on.
Thanks

Posted: Thu Jul 14, 2005 10:33 am
by pickle
Wrap your 'value' in quotes.

Code: Select all

<INPUT TYPE=TEXT Name="Company" value="<?php echo $Company;?>">
Your browser doesn't know 'Motors' is associated with 'General'

Posted: Thu Jul 14, 2005 10:35 am
by phpScott
I think your problem is lack of quotes.

Try

Code: Select all

<td width="195" height="48" align="center" bordercolor="#A00000"><input type="text" name="Company" value="<?php echo $Company;?>" /></td>
if that works then you will want to add quotes to all your text type fields.

You will also noticed I lower cased type and name as that will make it more standards complient, as well as the / at the end of the text field.

edit:darn it pickle beat me to it, to slow a typer i guess.

Posted: Thu Jul 14, 2005 10:47 am
by ut1205
It worked guys. Thanks. This is always the site to come for the answeres!