Form sends from one page but not from another

I have a site that uses a php script in the index page to detect if the user is on a mobile device. If they are, it displays a mobile version of a form they can submit for information. The form will submit successfully from the root but the same form will not send from a subsite in a folder that contains a different index page with the same code in it. Javascript is used in the page to validate fields and control the submit function.

You cannot see the live mobile version form except from a mobile phone. What would you need to troubleshoot this issue?

The form that works is here:
The form that does not work is here:

You can click the CALL ME button without entering any info in and it will show an error in red text at the top of the form on the one that works.
The second one does nothing when you click the sending button.

Here is a section of code used to format the form and to validate and submit the form:

<div id="orcallus">Call Us:</div>
		<div id="ourphone"><a href="tel:7133886284">713-388-6284</a></div>
		<div id="thanks2">Thank you! We will contact you shortly.</div>
		<div id="form2">
				<div id="contactform">Or WE'LL CALL YOU...use our handy  Form</div>
				<div id="error" style="display:none;font-weight:bold;color:red;">Please enter valid information for all fields.</div>
				<div class="mobile_name">Name</div>
				<input id="mobile_name2" type="text" />
				<div class="mobile_phone">Phone</div>
				<input id="mobile_phone2" type="text" />
				<div class="mobile_fromzip">Move from ZIP</div>
				<input id="mobile_fromzip2" type="text" />
				<div class="mobile_tozip">Move to ZIP</div>
				<input id="mobile_tozip2" type="text" />
				<div id="submit_form">CALL ME</div>
		<div id="howwehelp1">What We Offer:</div>
		<div id="howwehelp2">
				<div>1. Low Cost, Professional Moving</div>
				<div>2. Packing, Loading, Unloading</div>
				<div>3. Shrink-wrapping all items</div>
				<div>4. To/from storage</div>
				<div>5. Optional after-move cleanup</div>
		<div id="services1" style="width:100%;padding:6px 0;font-size:22px;color:#fff; margin:6px 0 6px;">SAME DAY MOVES, TOO!</div>
		<div id="services2" style="width:235px;margin:auto;text-align:left;text-transform:none;line-height:24px;font-size:17px;padding-left:10px;">
				<div>• Same Day Moves</div>
				<div>• Flat rate moves</div>
				<div>• Home moves</div>
				<div>• Apartment moves</div>
				<div>• Office moves</div>
				<div>• Storage moves</div>
		<div class="d-magazine-mobile"><img src="images/D-Mag-Best-Mover-2013.png" width="200" height="269" alt="Best Mover, D Magazine 2013" /></div>
		<a id="mainsite" href="">Main Site</a> </div>
<script type="text/javascript" language="javascript">
	$(document).ready(function() {
		$('#submit_form').click(function() {
			var name = $('#mobile_name2').val();
			var phone = $('#mobile_phone2').val();
			var fromzip = $('#mobile_fromzip2').val();
			var tozip = $('#mobile_tozip2').val();
			if (name.length < 3 || phone.length < 10 || fromzip.length <5 || tozip.length < 5) { 
			} else {
				$.post("mobileform.php", { name:name, phone:phone, fromzip:fromzip, tozip:tozip });

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Not sure if this will help, but many sites that have "mobile versions" use a subdomain for the mobile markup.


Both subdomains work on desktop or mobile, but they are optimized for one or the other.

Another strategy that is useful: Twitter Bootstrap markup can look good on either kind of browser.  Then you can use the same semantic markup HTML, the same JavaScript, and just change the CSS, which does not affect the meaning or behavior of the DOM elements.
weknowjackAuthor Commented:
Thanks. I am aware of those solutions, but I don't want to build something like that at this time. I am looking for a fix for what I now have. Can't understand why it works in one location on the same site and not in another.
Ray PaseurCommented:
If it were my site, I would start by making the markup valid.  The W3 validator is pretty strict and sometimes "invalid" markup (by its standards) can still work, but if you use W3-valid markup, and the HTML5 doctype, almost everything works right in modern browsers.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Dave BaldwinFixer of ProblemsCommented:
I don't see a 'Call Me' button on either page.  I clicked on the 'Contact' link and did not see any errors.
weknowjackAuthor Commented:
Thanks, Ray. I'll check it.

Dave, did you access it from a phone?
Dave BaldwinFixer of ProblemsCommented:
weknowjackAuthor Commented:
A phone is the only way to see the form referred to in this question. Some tablets maybe, but for sure a phone.
weknowjackAuthor Commented:
I have cleaned up the doctype. I'll do the rest later. It does not effect the action of the form, since it works fine in other places on the site. However, the doctype change made no difference. The form still will not submit.
weknowjackAuthor Commented:
The link to the jquery javascript file was incorrect. Fixed it and it works. Had to use Chrome to find it.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
weknowjackAuthor Commented:
It was the answer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.