PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
ut1205
Forum Commoner
Posts: 32 Joined: Thu Jan 29, 2004 5:12 pm
Post
by ut1205 » Thu Jul 14, 2005 10:17 am
:(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
pickle
Briney Mod
Posts: 6445 Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:
Post
by pickle » Thu Jul 14, 2005 10:33 am
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'
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
phpScott
DevNet Resident
Posts: 1206 Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.
Post
by phpScott » Thu Jul 14, 2005 10:35 am
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.
ut1205
Forum Commoner
Posts: 32 Joined: Thu Jan 29, 2004 5:12 pm
Post
by ut1205 » Thu Jul 14, 2005 10:47 am
It worked guys. Thanks. This is always the site to come for the answeres!