www.webdeveloper.com
Results 1 to 2 of 2

Thread: Echo data into text fields...

  1. #1
    Join Date
    Oct 2005
    Posts
    593

    Echo data into text fields...

    Wowza... have a problemo here!

    if you go to http://scott.loddonexplorers.co.uk/index_admin.php you will see!
    From what i can see, all the text should be in text fields...

    Here is my code!
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    </head>

    <body>
    <?
    require 'xxx';

    $query="SELECT * FROM Front_Page";
    $result=mysql_query($query);
    $num=mysql_numrows($result);
    mysql_close();
    $i=0;
    while (
    $i $num
    {
    $Nav_Bar=mysql_result($result,$i,"Nav_Bar");
    $Next_Meeting=mysql_result($result,$i,"Next_Meeting");
    $Next_Meeting_Text=mysql_result($result,$i,"Next_Meeting_Text");
    $Program_Title=mysql_result($result,$i,"Program_Title");
    $Program_Text=mysql_result($result,$i,"Program_Text");
    $Iceland_Title=mysql_result($result,$i,"Iceland_Title");
    $Iceland_Text=mysql_result($result,$i,"Iceland_Text");
    $Images_Title=mysql_result($result,$i,"Images_Title");
    $Images=mysql_result($result,$i,"Images");

    $i++; 

    ?>
    <input name="Nav_Bar" type="text" value="<?php echo $Nav_Bar ?>" /> 
    <input name="Next_Meeting" type="text" value="<?php echo $Next_Meeting ?>" /> 
    <input name="Next_Meeting_Text" type="text" value="<?php echo $Next_Meeting_Text ?>" /> 
    <input name="Program_Title" type="text" value="<?php echo $Program_Title ?>" /> 
    <input name="Program_Text" type="text" value="<?php echo $Program_Text ?>" /> 
    <input name="Iceland_Title" type="text" value="<?php echo $Iceland_Title ?>" /> 
    <input name="Iceland_Text" type="text" value="<?php echo $Iceland_Text ?>" />
    <input name="Images_Title" type="text" value="<?php echo $Images_Title ?>" />
    <input name="Images" type="text" value="<?php echo $Images ?>" />
    </body>
    </html>
    And some of the fields in the data base contain pure HTML if you needed to know that...

    Thanks in advance!
    Fet

  2. #2
    Join Date
    Jan 2005
    Location
    Alicante (Spain)
    Posts
    7,742
    One approach would be to use htmlentities either before data insertion into MySQL or on extraction:
    PHP Code:
    <input name="Nav_Bar" type="text" value="<?php echo htmlentities($Nav_Bar?>" />

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles