user2432772
user2432772

Reputation: 233

Input Form database styling

So I am trying to create form that user will use to add data to database here is example:

<form method="get" action="">
English Word: <input name='word'>
</form>
<?php
$word=$_GET['word'];
$sql="INSERT INTO engdic (`EnglishWord`) VALUES ('<li><b>$word</b></li>')";
?>

So the idea is costumer will input just plain text and threw php it will add html tags to that text that will apply specific styling. What I am really looking is for good example or any idea how to do it correctly officient etc. I will have about 20 different another example field for url for video so instead of costumer adding link with html tagst etc. code , I want that costumer only add url and rest is added by js or php . Sorry for my bad English and I hope the my idea is clear. Thank you for your time.

Upvotes: 1

Views: 140

Answers (2)

Dipesh Parmar
Dipesh Parmar

Reputation: 27364

You can store it by creating one new variable and then save that variable.

$save = '<li><b>'.$word.'</b></li>';

INSERT INTO engdic (`EnglishWord`) VALUES ('$save')

Upvotes: 1

OneOfOne
OneOfOne

Reputation: 99254

Save just the word in the database, style it right before you display it.

Upvotes: 1

Related Questions