Jump to content


Photo

echo text field


  • Please log in to reply
3 replies to this topic

#1 me1000

me1000
  • Members
  • PipPipPip
  • Advanced Member
  • 183 posts

Posted 12 March 2006 - 03:26 AM

OK I have a non editable text field inside of a loop. I want the text field value to be the $link var...

$link = 'http://www.site.com/index.php?page_id='.$page_id;

echo "<TR><TD>$page_title</TD><TD>$page_id</TD></TR>";
echo '<TR><TD><input type="text" name=myText value="<?php echo $link; >?"  style="background-color: #CCCCCC" readonly></TD></TR>';

can you please explain to me why this doesnt work?

#2 High_-_Tek

High_-_Tek
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts

Posted 12 March 2006 - 03:57 AM

You had the ?> backwards

value="<?php echo $link; ?>"


#3 me1000

me1000
  • Members
  • PipPipPip
  • Advanced Member
  • 183 posts

Posted 12 March 2006 - 04:17 AM

changed it and still no luck heres the whole loop...

<?

echo "<TABLE BORDER=0>";
while ($row = mysql_fetch_array($sql_result)) {


$page_id = $row["ID"];
$page_title = $row["PAGE_TITLE"];
$link = 'http://www.site.com/index.php?page_id='.$page_id;

echo "<TR><TD>$page_title</TD><TD>$page_id</TD></TR>";
echo '<TR><TD><input type="text" name=myText value="<?php echo $link; ?>"  style="color: #000000; background-color: #CCCCCC" readonly></TD></TR>';
echo '<TR><TD><hr></TD></TR>';
}
echo "</TABLE>";


?>


never mind I figured it out

echo '<TR><TD><input type="text" name=link value="'.$link.'" style="color: #000000; background-color: #CCCCCC" readonly></TD></TR>';

simple enough! :P

#4 keeB

keeB
  • Staff Alumni
  • Advanced Member
  • 1,078 posts
  • LocationCalifornia

Posted 12 March 2006 - 07:10 AM

you are aware that..

$x = "abc123";

print $x;
print "$x";
print " " . $x . " ";

take note of the second example... there's no reason to escape the string if you're using print.

Come visit my site to see my latest projects
http://nick.stinemates.org/wordpress/





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users