Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
PHP : format an html <div> to display it correctly

Hello I want to get this but when I store my div in my database and when I try to display it I can't display it correctly can you help me?

Desired outcome:

<div data-tpl="header1" data-title="Header 1" class="drop-element"><label>LABEL 111</label></div>
<div data-tpl="header2" data-title="Header 2" class="drop-element"><input class="form-control" value="" id="changeInput" placeholder="INPUT 222"></div>

In my database :

<div data-tpl=\"header1\" data-title=\"Header 1\" class=\"drop-element\"><label>LABEL 111</label></div>
<div data-tpl=\"header2\" data-title=\"Header 2\" class=\"drop-element\"><input class=\"form-control\" value=\"\" id=\"changeInput\" placeholder=\"INPUT 222\"></div>

Display on the web page using this function on my page.php but the display is not correct :

preg_replace('/\\\\/', '', $formChaine);

unwanted result I have on the web page:

<div data-tpl="\&quot;header1\&quot;" data-title="\&quot;Header" 1\"="" class="\&quot;drop-element\&quot;"><label>LABEL 111</label></div>
<div data-tpl="\&quot;header2\&quot;" data-title="\&quot;Header" 2\"="" class="\&quot;drop-element\&quot;"><input class="\&quot;form-control\&quot;" value="\&quot;\&quot;" id="\&quot;changeInput\&quot;" placeholder="\&quot;INPUT" 222\"=""></div>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Everything is being escaped probably as a security measure to protect your database from sequel injection. You need to unescape it to display it. You could do it on the php side with stripcslashes when you read it from the database: https://www.php.net/manual/en/function.stripcslashes.php.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!