Search code examples
phphtmlinputrequired

Why im getting <input type="email" value="required"> when i really need is <input type="email" value="" required>


im using php code and my full php code is:

echo "<input type=\"email\" class=\"profil_input_text form-control\" name=\"user_email\" pattern=\"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$\" title=\"" . (new LangLibry())->Word('form', 'emaillong') . "\" placeholder=\"" . (new LangLibry())->Word('form', 'emaillong') . "\" required>";

and the html code that is outputted is this:

<input type="email" class="profil_input_text form-control" name="user_email" pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$" title="Email" placeholder="Email" value="required">

i tried a lot of things to fix this, but it seems i dont see where the real problem is and i cant fix it. i need ur help! thanks!

FIX IT: i resove the issue thanks to you guys! it turn out it was an if problem in my php code and this was not the code that was executed and it was a diffrent code, this one:

echo "<input type=\"email\" class=\"profil_input_text form-control\" name=\"user_email\" pattern=\"^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$\" title=\"" . (new LangLibry())->Word('form', 'emaillong') . "\" placeholder=\"" . (new LangLibry())->Word('form', 'emaillong') . "\" value=" . $_SESSION['Login']['Email'] . " required>";

and because the $_SESSION['Login'] is empty, because no one have been logged in, thats why it seems to problem to be in this part of the code: $_SESSION['Login']['Email'] thank you guys again!!!


Solution

  • Works as for me with FF 33 when replacing the usage of the class method. So maybe the issue is introduced by the returned value from Word()?