blink359 Posted November 9, 2010 Share Posted November 9, 2010 Hi there i was wondering how i would go about using html tags inside the php tags so i could put data from a database into a textarea / text input i had a go but had no such luck with this attempt: <?php echo "Title:<br>"; echo "<input type="text" name="title" value="$row['Title']">"; ?> the code above is to give you an idea of what i want to do, if you can point me to any guides or show me how it will be greatly appriciated Thanks, Blink359 Quote Link to comment https://forums.phpfreaks.com/topic/218205-using-html-tags-inside-php/ Share on other sites More sharing options...
doddsey_65 Posted November 9, 2010 Share Posted November 9, 2010 You need to include \'s echo "Title:<br>"; echo "<input type=\"text\" name=\"title\" value=\"{$row['Title']}\" />"; Quote Link to comment https://forums.phpfreaks.com/topic/218205-using-html-tags-inside-php/#findComment-1132277 Share on other sites More sharing options...
Adam Posted November 9, 2010 Share Posted November 9, 2010 OR a better solution is to use single quotes and use the dot operator to concatenate variables: echo 'Title:<br>'; echo '<input type="text" name="title" value="' . $row['Title'] . '" />'; Quote Link to comment https://forums.phpfreaks.com/topic/218205-using-html-tags-inside-php/#findComment-1132278 Share on other sites More sharing options...
Adam Posted November 9, 2010 Share Posted November 9, 2010 ... OR .. of course the best solution would be to not echo out HTML at all: Title:<br /> <input type="text" name="title" value="<?php echo $row['Title']; ?>" /> Quote Link to comment https://forums.phpfreaks.com/topic/218205-using-html-tags-inside-php/#findComment-1132279 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.