Append two address html fields in a php form -


In one form, I would like two address fields for people with long addresses, but I'm not sure how to do this Here's how my form looks:

  & lt ;? php #other..code if isset ($ _ POST ['email']) {$ postinfo = http_build_query (array ('lname $ = $ name,' boolean '= & gt; $ lname,' fname '= & gt; $ fname, 'email' = & gt; $ email, 'address' = & gt; $ address,' list '= & gt; true')); } #other..code? & Gt; & Lt; Div & gt; & Lt; label for = "fname" & gt; First name & lt; / Label & gt; & Lt; Input type = "text" name = "fname" id = "fname" /> gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt; label for = "lname" & gt; Last name & lt; / Label & gt; & Gt; Input type = "text" name = "lname" id = "lname" /> gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt; For label = "email" & gt; Email & lt; / Labels & gt; & Lt; Input type = "article" name = "email" id = "email" /> gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt; Label = "address" & gt; Address & lt; / Label & gt; & Lt; Input type = "text" name = "address" id = "address" /> gt; & Lt; / Div & gt;   

So what do I want to have two separate address fields like this:

   & Lt; / Div & gt; & Lt; Div & gt; & Lt; Label = "address" & gt; Address 2 & lt; / Labels & gt; Input type = "text" name = "address" id = "address" /> & Lt; / Div & gt; You can use an input array like the following:    

  & lt; Input type = "text" name = "address ['longAddress]" id = "address" /> & Lt; input type = "text" name = "address ['shortAddress]" id = "address" />   

And then access them in php like this.

  echo $ _POST ['address'] ['longAddress']; Echo $ _POST ['address'] ['shortAddress'];    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -