is it possible to store plain html code inside mysql table after submitting a form? For example, I would like to create a new post for my blog using my custom cms in laravel and I want to store all the <h>, <p> etc.. elements inside one column.
-
Yes, you can store the all the HTML tags, submitted through the form.Kinshuk Lahiri– Kinshuk Lahiri2018-02-24 17:44:59 +00:00Commented Feb 24, 2018 at 17:44
-
could you tell me how, please?Dominykas Česonis– Dominykas Česonis2018-02-24 17:46:33 +00:00Commented Feb 24, 2018 at 17:46
-
You just need to design your schema to store the text and tags you wantMike Tung– Mike Tung2018-02-24 17:48:18 +00:00Commented Feb 24, 2018 at 17:48
-
@DominykasČesonis Store the data inside column with type text. It will store all the tags.Kinshuk Lahiri– Kinshuk Lahiri2018-02-24 18:55:17 +00:00Commented Feb 24, 2018 at 18:55
-
1Please do not vandalize your posts. By posting on Stack Overflow, you’ve granted Stack Exchange the rights to the content you post under the CC BY-SA 4.0 licence, regardless of any changes you may make. Vandalizing your posts will result in the edit being reverted, and continuous vandalism may lead to your post being locked.Fastnlight– Fastnlight2024-02-21 17:28:39 +00:00Commented Feb 21, 2024 at 17:28
Add a comment
|
1 Answer
$data['name'] = '<h1>'.$request->name.'</h1>';
to encode this data use below
$name = base64_encode($data['name']);
Post::create(['name'=>$name]);
1 Comment
Hamelraj
check this stackoverflow.com/questions/37338770/…