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!
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 ö with &ouml;
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
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>
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 ?
as said above more info would rock.
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:
look at itCode:<input type='text' name='content' size='63.5' value='<?php echo $row['name']; ?>'" /><br>
'"
try
Code:<input type='text' name='content' size='63.5' value="<?php echo $row['name']; ?>" /><br>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks