Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    36
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Form not working on iPhones?

    Can't really work this one out and I don't have an iPhone to test but I've done a form on a friends website and she is saying it's not working. I've done many tests and it's working for me. So the only thing i can put it down to is that the below form doesn't work on an iPhone for some reason? Any thoughts on why?? Thank you in advance...

    The jQuery:

    Code:
    <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
    <script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript">
    $(function(){
    	$('#contact_form').submit(function(e){
    		e.preventDefault();
    		var form = $(this);
    		var post_url = form.attr('action');
    		var post_data = form.serialize();
    		$('#loader', form).html('<img src="loader.gif" /> Please Wait...');
    		$.ajax({
    			type: 'POST',
    			url: post_url, 
    			data: post_data,
    			success: function(msg) {
    				$(form).fadeOut(500, function(){
    					form.html(msg).fadeIn();
    				});
    			}
    		});
    	});
    });
    </script>
    And The Form:

    Code:
    <form action="process.php" method="post" id="contact_form">
    <div>
    <label for="name">Your Name:</label><br />
    
    <input name="name" type="text" id="name" tabindex="1" value="" size="35" />
    </div>
    <div>
    <label for="email">Your Email:</label><br />
    
    <input name="email" type="text" id="email" tabindex="2" value="" size="35" />
    </div>
    <div>
    <label for="message">Message:</label><br />
    
    <textarea cols="40" rows="8" name="message" id="message"></textarea>
    </div>
    <div id="loader"><br />
    
    <input type="submit" value="Submit" />
    </div>
    </form>
    <div id="message_post"></div>
    And the PHP Process:

    PHP Code:
    <?php
    $toemail 
    'test@youremail.com';
    $name $_POST['name'];
    $email $_POST['email'];
    $message $_POST['message'];
    if(
    mail($toemail'Subject'$message'From: ' $email)) {
    echo 
    'Your email was sent successfully.';
    } else {
    echo 
    'There was a problem sending your email.';
    }
    ?>

  • #2
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    852
    Thanks
    173
    Thanked 94 Times in 94 Posts
    Hi

    I can see two js libs

    Code:
    <script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    pretty sure you only need one --- try removing the first one

    LT
    "The greatest revenge is to accomplish what others say you cannot do."
    ~ Unknown

    I used to be indecisive, but now I'm not so sure.

  • #3
    New Coder
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    36
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by low tech View Post
    Hi

    I can see two js libs

    Code:
    <script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    pretty sure you only need one --- try removing the first one

    LT
    Ok thanks low_tech I hope it's as simple as the double up on jQuery. I'll try to remove this and get her to re-test.

    I was thinking it would have something to do with whatever browser the current iPhones are using?

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,049
    Thanks
    2
    Thanked 317 Times in 309 Posts
    Define: it's not working? It causes the phone to burst into flames or what, as that would help point to where the problem is at.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • #5
    New Coder
    Join Date
    Mar 2008
    Location
    Australia
    Posts
    36
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by CFMaBiSmAd View Post
    Define: it's not working? It causes the phone to burst into flames or what, as that would help point to where the problem is at.
    Hi CFMaBiSmAd, I'm actually not sure as I've tested it in Chrome / Firefox in both PC and on my Android. All worked form was sent (success message) and received. So as I don't have an iPhone I don't know exactly what's it's doing. She just says it's not working. So my question is probably more aimed at any known glitches with PHP/jQuery forms and iPhones?


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •