Closed Thread
Results 1 to 7 of 7

Thread: Textbox Value

  1. #1
    Bioshox is offline Programmer
    Join Date
    Oct 2009
    Location
    Manchester, UK
    Posts
    196
    Rep Power
    10

    Textbox Value

    Hey!

    Id like to get the value of this textbox from a row in a MySQL database, iv tried with this code:

    Code:
    	while($row = mysql_fetch_assoc($res)) {
    	$row['body'] = str_replace("<br>", "\n", $row['body']);  
    
    		echo '<h3>Previous Name: <br>' . htmlspecialchars(stripslashes(($row['name']))) . '</h3>';
    
    	}
    	else:
    		echo '<p>Oh Dear, This Is Embarrassing, It seems we cant find what your looking for!</p>';
    		
    
    		
    	endif;
    	
    	
    	}
    	
    //Ends Our Class
    
    
    
    //Displays the posts
    
    
    			get_content();
    ?>
    <p>
    
    <form action='updatename.php' method='post'>
    <input type='text' name='content' size='63.5' value='<?php echo $row['name']; ?>'" /><br>
    <br>
    <input type='submit' name='submit' value='Edit Name' />
    </p>

    Any idea how I can get this working, its tearing my hair out!

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Sep 2007
    Location
    Karlstad, Sweden
    Posts
    3,082
    Blog Entries
    7
    Rep Power
    42

    Re: Textbox Value

    why are you struggling with htmlspecialchars(stripslashes(($row['name']))) ??????

    if you have done an mysql_real_escape_string() when you saved it into the database, you don't need the stripslashes on the way out. If you are afraid that they were adding html code, you should have done your specialchars on the way in, and don't need to do it again on the way out, as it would destroy the & in front of for example &ouml; with &amp;ouml;
    __________________________________________
    I study Information Systems at Karlstad University when I'm not on CodeCall

  4. #3
    Bioshox is offline Programmer
    Join Date
    Oct 2009
    Location
    Manchester, UK
    Posts
    196
    Rep Power
    10

    Re: Textbox Value

    Quote Originally Posted by Orjan View Post
    why are you struggling with htmlspecialchars(stripslashes(($row['name']))) ??????

    if you have done an mysql_real_escape_string() when you saved it into the database, you don't need the stripslashes on the way out. If you are afraid that they were adding html code, you should have done your specialchars on the way in, and don't need to do it again on the way out, as it would destroy the & in front of for example &ouml; with &amp;ouml;
    THat's not the bit of the code im stuck at

    I want to return the data stored in teh SQL table into the Text Box

    The code I need to fix is this

    Code:
    <form action='updatename.php' method='post'>
    <input type='text' name='content' size='63.5' value='<?php echo $row['name']; ?>'" /><br>
    <br>
    <input type='submit' name='submit' value='Edit Name' />
    </p>

  5. #4
    Jaan Guest

    Re: Textbox Value

    Um.. try to print that value to somewhere else.. then you can see if it works, but if it don't work then there's something wrong with your SQL part..

    can you show us the content of $res ?

  6. #5
    brokenbylaw's Avatar
    brokenbylaw is offline Learning Programmer
    Join Date
    Dec 2009
    Posts
    62
    Rep Power
    0

    Re: Textbox Value

    as said above more info would rock.

  7. #6
    Bioshox is offline Programmer
    Join Date
    Oct 2009
    Location
    Manchester, UK
    Posts
    196
    Rep Power
    10

    Re: Textbox Value

    Yeah, the information alreday echo's as I have it saying Previous: and whatever was in the row, as I cant get it working inside the text box D:

  8. #7
    brokenbylaw's Avatar
    brokenbylaw is offline Learning Programmer
    Join Date
    Dec 2009
    Posts
    62
    Rep Power
    0

    Re: Textbox Value

    Code:
    <input type='text' name='content' size='63.5' value='<?php echo $row['name']; ?>'" /><br>
    look at it

    '"

    try

    Code:
    <input type='text' name='content' size='63.5' value="<?php echo $row['name']; ?>" /><br>

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Can't take value from textbox
    By socheata in forum PHP Development
    Replies: 6
    Last Post: 09-24-2010, 03:17 AM
  2. Textbox focusing?
    By blackriderrom in forum JavaScript and CSS
    Replies: 3
    Last Post: 01-13-2010, 08:05 AM
  3. 3 variable and textbox
    By bordino in forum Visual Basic Programming
    Replies: 4
    Last Post: 12-30-2009, 06:35 PM
  4. Autocomplete Textbox in C#
    By alipalang in forum C# Programming
    Replies: 1
    Last Post: 10-13-2009, 05:02 PM
  5. Textbox question
    By deas in forum Visual Basic Programming
    Replies: 6
    Last Post: 03-15-2009, 03:15 PM

Tags for this Thread

Bookmarks

Posting Permissions

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