0

I have a form an need replace button in my form with another data. I should use php regex and replace it. My form sample this is:

  <form name="ialRegister" id="ialRegister" method="post">
    <input type="text" name="name" id="name">
    <input type="text" name="email" id="email">
    <input type="text" name="mobile" id="mobile">
    <label data-attr="subtitle" class="smallTxt hidden" for="ialButton10"></label>
    <button class="loginBtn ial-submit" name="submit" id="ialButton10">
        <span><i class="ial-load" style="visibility: hidden;"></i>
        <span data-attr="label">Register</span></span>
    </button>
 </form>

and I used this regex but it's not working:

  $newField = 'custom data';
  $form = preg_replace("#(<form.*id=\"ialRegister\".*>.*)
 <button.*name=\"submit\".*>.*<\/button>(.*<\/form>)#sU", '$1'.$newField.'$2', $form);

How can do it?

Matin
  • 597
  • 3
  • 8
  • 18

0 Answers0