包装<a href=" around inputted form data

时间:2018-08-10 13:18:42

标签: html forms input hyperlink contact-form

<p>I'm making a PHP contact form that a user inputs a url e.g: 'www.google.com'. On submit, I need the address to be wrapped into a href attribute. So its stored into my database as: <@ href=" www.google.com"="">Visit Site<|a>

I have tried using multiple hidden inputs and and escape chars, but obviously the formatting doesn't allow the value to be entered correctly so I've tried using special chars and most likely leaves it open for spoofing.

     <div class="form-group">
  <input type="hidden" name="URL[]" value="&lt;a href=&quot;&gt;"> <!--<a href="-->
                  <label for="URL">URL link</label>      
                  <input type="url" class="form-control" id="URL" name="URL[]" value-hidden="https">
                  <input type="hidden" name="URL[]" value="&quot;&lt;&sol;a&gt;"> <!--"</a>-->
                </div>

Is there a way? Perhaps using JQuery or should I consider implementing this in my post method? Thanks!

0 个答案:

没有答案