FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


The information is not displayed in Textarea





bukaida
In an update script, I want the data from mysql to be displayed on textbox and textarea so that the user can edit it manualy.The textbox is working fine but the same code with textarea is not working.
Code:

echo'<p><tr><td><b><font face="Sylfaen" color="#008000">Title page:</font></b></td><td>
<input type="text" name="title_page" size="20" value="'; echo $title_page; echo'">';
echo'</td></tr></p>';

is working fine but
Code:

echo'<p><tr><td><b><font face="Sylfaen" color="#008000">Title page:</font></b></td><td>
<textarea name="title_page" cols="25" rows="25" value="'; echo $title_page; echo'">';
echo'</textarea></td></tr></p>';
is not working.Please help.
b4r4t
Because textarea doesn't have value="" thing Smile You place something in textarea by

<textarea>PUTTING IT BETWEEN TEXTAREA MARKUPS</textarea>

Smile

BTW - for long "static" text You should escape from PHP Smile It will be much cleaner than using echos all the time.

Code:
<?php
// some PHP code goes here

//and we then escape for pure HTML
?>
<p><tr><td><b><font face="Sylfaen" color="#008000">Title page:</font></b></td><td>
<textarea name="title_page" cols="25" rows="25">
<?
//We need PHP then we again enter to PHP
php echo $title_page;
?>
</textarea></td></tr></p>


ECHOing everything will make Your HTML editing much harder because syntax highlight for HTML wont work in echo because then it's only string assigned to var.
Next thing is that static HTML lines will be rendered much faster then for example 1000 ECHO instructions Smile Echo uses your server resources (not much but always), because insteed of just sending regular HTML to Your browser, it have to render this HTML first by PHP engine Smile

Next thing is that You don't have to echo each line if You escaped from the string. Us mark sign "."

Code:

<?php
$string = '<a href="'.$linkurl.'" class="urlclass" title="'.$linkdescr.'">"'.$linkname.'"</a>';
?>


BTW - don't use "font" , "color" etc in your HTML. Learn how to use CSS and write semantic code. Tables arn't good for design neither (only for tabullar data).
bukaida
Thanx boss.I am just in beginners state.Thank you very much for giving good php programming tips.
I will make my habit to follow these guidelines.
Related topics
[ java scripts ] email service
[java scripts] System information
Facing Many Problems
Gates: 'Information overload' is overblown
Spoofing in Mozilla ( FireFox) browser flaw
E-Cards with PHP & MySQL
DNS Information
more information
Global Computer Sales Up 17 Percent In Quarter: Analysts
Who clicks on ads nowadays?
Can frames be a good choice? What then?
Photoshop tips
Extremely Low Costing phpBB2 and 3 Services [UPDATED]
CPU-Z: System Analysis
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.