0

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.

5
  • Yes, you can store the all the HTML tags, submitted through the form. Commented Feb 24, 2018 at 17:44
  • could you tell me how, please? Commented Feb 24, 2018 at 17:46
  • You just need to design your schema to store the text and tags you want Commented Feb 24, 2018 at 17:48
  • @DominykasČesonis Store the data inside column with type text. It will store all the tags. Commented Feb 24, 2018 at 18:55
  • 1
    Please 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. Commented Feb 21, 2024 at 17:28

1 Answer 1

0
$data['name']  = '<h1>'.$request->name.'</h1>';

to encode this data use below

$name = base64_encode($data['name']);
Post::create(['name'=>$name]);
Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.