Current location: Hot Scripts Forums » Programming Languages » PHP » Only the first word is displayed in the form when editing.


Only the first word is displayed in the form when editing.

Reply
  #1 (permalink)  
Old 11-02-04, 09:26 PM
jozin jozin is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Only the first word is displayed in the form when editing.

Hi everybody,

I have this problem:

I have a list of employees their name, address, and date of birth.

Emp. ID Emp. Name Address Date of Birth

001 Ricky Puno Angeles City, Phil 1985-08-01 edit delete
002 Jim Gomez Quezon City, Phil 1980-05-08 edit delete

My problem is that when I try to edit a data, for example employee 001, only the first word is displayed in the Employee Name field and Address Field:

Emp. ID: 001
Emp. Name: Ricky
Address: Angeles
Date of Birth: 1985-08-01

I don’t know what is wrong with my code. Deleting and saving data in the database(MySQL) is OK.


This is my code when editing or deleting a data is:

echo "<TD>
<A HREF='addeditemp.php?process=edit&empID=
$row->employeeID&empname=$row->employeename=
$row->employeeID&address=$row->Address=
$row->employeeID&bday=$row->Birthday'>edit
</A>
</TD>";
echo "<TD>
<A HREF='Procemp.php?process=del&empID= $row->employeeID&empname=$row->employeename'>delete
</A>
</TD>";


This is my addeditemp.php code:

<HTML>
<?php
include("Opendb.php");
?>
<HEAD>
<TITLE>Add Employee</TITLE>
</HEAD>
<BODY>
<BR>
<BOLD>Add Employee </BOLD>
<BR>
<FORM ACTION="Procemp.php?" method="post">
<input type=hidden name="process" value=<?php echo $process; ?>>
ID:<input type ="text" name="empID" value=<?php if (isset($empID)) { echo $empID; } ?>><BR>
Name:<input type ="text" name="empname" value=<?php if (isset($empname)) { echo $empname; } ?>><BR>
Address:<textarea name="address" cols="50" rows="3" value=<?php if (isset($address)) { echo $address; } ?>></textarea><BR>
Date of Birth:<input type ="text" name="bday" value=<?php if (isset($bday)) { echo $bday; } ?>><BR>
<input type ="submit"><input type="reset">
</FORM>
</BODY>
</HTML>

All of your comments and suggestions will be much appreciated.

Thanks a lot,

Jozin.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-02-04, 09:48 PM
moronovich moronovich is offline
Junior Code Guru
 
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
hello jozin,
the problem you face right now is because you don't use double quotes to enclose the value of input attribute "value". for example in:
Code:
<input type ="text" name="empname" value=<?php if (isset($empname)) { echo $empname; } ?>>
by rewriting it into
Code:
<input type ="text" name="empname" value="<?php if (isset($empname)) { echo $empname; } ?>" />
the problem should be solved.

regards,
__________________
just an ignorant noob with moronic solution...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-03-04, 02:16 AM
jozin jozin is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Hi moronovich,

Thanks it worked. but there's still an error somewhere.
The result is,

Emp. ID: 001
Emp. Name: Ricky Puno= 1
Address: Angeles City, Pampanga, Phil= 1
Date of Birth: 1985-08-01

How can i remove the "= 1" at the end of the text field?

Thanks for the help.

Jozin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-03-04, 04:45 AM
moronovich moronovich is offline
Junior Code Guru
 
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
please look at your code:
Code:
echo "<TD>
<A HREF='addeditemp.php?process=edit&empID=
$row->employeeID&empname=$row->employeename=
$row->employeeID&address=$row->Address=
$row->employeeID&bday=$row->Birthday'>edit
</A>
</TD>";
i'm sure you'll soon know why there is always trailing '=1' on the output.
__________________
just an ignorant noob with moronic solution...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-06-04, 02:57 AM
jozin jozin is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Yeah I got it

Hi,

I can't help but laugh at myself when I realized my mistake. Your absolutely right. The culprit is the way I arranged my code.

I hope you won't get tired of my silly problems.

Thanks a lot and more power.

jozin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 11-07-04, 02:18 AM
moronovich moronovich is offline
Junior Code Guru
 
Join Date: Oct 2004
Posts: 460
Thanks: 0
Thanked 0 Times in 0 Posts
you're welcome..
__________________
just an ignorant noob with moronic solution...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
lock form fields using checkbox jonathen JavaScript 5 02-04-05 04:35 PM
formmail problem gscraper Perl 12 08-27-04 04:06 AM
Limit the form submission according to time bionicsamir PHP 7 05-10-04 12:10 AM
submit form? tcooper PHP 5 12-12-03 04:30 PM
SQL database registration form help vinhkhuong PHP 3 10-10-03 04:49 AM


All times are GMT -5. The time now is 01:21 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.