Noskiw Posted October 28, 2010 Share Posted October 28, 2010 This is my code <?php if(isset($_REQUEST['message'])){ $to = '[email protected]'; $subject = "Contact Form"; $message = "From: " . $_REQUEST['name']; $message.= "Email: " . $_REQUEST['email']; $message.= "Message: " . $_REQUEST['message']; $header = "From: Noskiw!"; if(mail($to, $subject, $message, $header)){ echo "Your Message has been sent!"; }else{ echo "There was a problem sending your message"; } die(); } ?> <html> <head> <title>Jquery Ajax Form</title> <link href="./csss.css" type="text/css" rel="stylesheet" /> <script type="text/javascript" src="./jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#contactForm').submit(function(){ var inputs = []; $(':input', this).each(function(){ inputs.push(this.name + '=' + escape(this.value)); }); jQuery.ajax({ data: inputs.join('&'), url: this.action, timeout: 2000, error: function(){ console.log("Failed to submit"); }, success: function(r){ alert(r); document.getElementById("contactForm").reset(); } }); return false; }); }); </script> </head> <body> <div class="container" style="margin: none;"> <div id="content_text"> <h1>jQuery Ajax Forms</h1> <form action="contact.php" method="get" id="contactForm"> <table align="top" cellpadding="3" cellspacing="3" border="0"> <tr> <td>Email: </td> <td> <input type="text" name="email" value="" id="email" style="border: 1px solid #000" /> </td> </tr> <br /> <tr> <td>Name: </td> <td> <input type="text" name="name" value="" id="name" style="border: 1px solid #000" /> </td> </tr> <br /> <tr> <td>Message: </td> <td> <textarea name="message" id="message" style="border: 1px solid #000"></textarea> </td> </tr> <br /> <tr> <td align="right" colspan="2"> <input type="submit" value="Send Message" style="border: 1px solid #000" /> </td> </tr> </table> </form> </div> </div> </body> </html> There is a huge white space right above the table, is there anyway that I could get rid of this? Link to comment https://forums.phpfreaks.com/topic/217101-table-help-please/ Share on other sites More sharing options...
haku Posted October 28, 2010 Share Posted October 28, 2010 Try validating your code with the HTML validator. You don't have a doctype. HTML errors cause problems like you are having - particularly if you have no doctype. Link to comment https://forums.phpfreaks.com/topic/217101-table-help-please/#findComment-1127641 Share on other sites More sharing options...
nimesha Posted November 2, 2010 Share Posted November 2, 2010 Check your style sheet..This code is ok.but most probably the problem is with the css Link to comment https://forums.phpfreaks.com/topic/217101-table-help-please/#findComment-1129307 Share on other sites More sharing options...
nano Posted November 2, 2010 Share Posted November 2, 2010 Check out Firebug for Firefox addon: https://addons.mozilla.org/en-US/firefox/addon/1843/ It will let you inspect respective elements from your HTML and highlight issues such as paddings or margins. You can also edit on the fly. Good luck. Link to comment https://forums.phpfreaks.com/topic/217101-table-help-please/#findComment-1129421 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.