Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

how to post hidden input from split input text

Avatar of Johnny
JohnnyFlag for United States of America asked on
PHPjQuery
6 Comments1 Solution379 ViewsLast Modified:
i want to be able to split a text box i have that populates from jquery
and make it pass via post with split values

 
<li id="li-4-11"><label id="label-4-11" for="cf4_field_11"><span> Zip code (autofill for USA only)</span></label>&nbsp;<input type="text" name="mailing_zipcode" id="mailing_zipcode" maxlength="5" title="Enter Zip Code for autofill" class="number" value="" onkeydown="javascript:maskInput()"/></li>
<li id="li-4-11"><label id="label-4-11" for="cf4_field_11"><span> City/State/Zip (Will auto fill if zip code is entered above)</span></label>&nbsp;<input type="text" name="city_sate_zip" id="city_sate_zip" title="Enter Zip Code above for autofill"class="single" value=""/></li>

then i have it parsing for the info
 
$("#mailing_zipcode").bind("blur", function(e){
                var EnteredValue = $.trim($("#mailing_zipcode").val());
                var TestValue = EnteredValue.replace(" ", "");
                //alert(EnteredValue);
                //alert(TestValue);
                 if (isNaN(TestValue)) {
                         alert("You must enter 5 Numbers only, for valid Zip Code")
                         $("#mailing_zipcode").val("");
                         $("#city_sate_zip").val("");
                }
                else {
//alert ($("#zip").val());
  $.getJSON("zip_lookup.php?zip=" + $("#mailing_zipcode").val(),
        function(data){
          $.each(data, function(i,item){
            if (item.field == "city_sate_zip") {
            //alert(item.field);
              $("#city_sate_zip").val(item.value);
              //alert(item.value);
            }
          });
        });
        }
});
and this all works great

my problem is the city and state are now on one line city_sate_zip
i need it to pass as post
mailing_city
mailing_state

how do i do i separate the values and pass them via hidden inputs please

im using jquery and php in my page if that helps

thank you in advance for any code or help you may provide

ASKER CERTIFIED SOLUTION
Avatar of Greg Alexander
Greg AlexanderFlag of United States of America imageLead Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers