Marvin0410 Posted August 19, 2010 Share Posted August 19, 2010 Hello all, I'm sorry for posting twice in one week; I'm teaching myself PHP at the moment...it isn't easy, but it's rewarding . That being said, I'm trying to make an email form using PHP...I handle page navigations by getting HTML from text files and calling $(div_name).html(text);. Works fine up until I call the HTML for my form; the Email Me button doesn't even click! I'm not sure if this is a PHP problem, but any help would be greatly appreciated! The HTML I call from a text file is as follows: <form name="contactform" method="post" action="form_email.php"> <table width="100%" border="0"> <tr> <td>Name: </td> <td> <input type="text" name="_name" maxlength="30" size="30" /> </td> </tr> <tr> <td>Contact Email: </td> <td> <input type="text" name="email_address" maxlength="30" size="30" /> </td> </tr> <tr> <td> Message: </td> <td> <input type="text" name="_message" maxlength="500" width="100" height="300" /> </td> </tr> <tr> <td> <input type ="Submit" name="Submit" value="Email Me!" /> </td> </tr> </table> </form> The AJAX I use to insert the above text as HTML in a div is: $.ajax({ url : "introtext.txt", success : function (data) { $("#mainbody").html(data); } }); Finally, the PHP for the form is: <?php //variables $email_to = "mserrano0410@gmail.com"; $email_subject = "Inquiry from my personal website"; $sender_name = $_POST['_name']; $sender_email = $_POST['email_address']; $sender_message = $_POST['_message']; //set up the message to send. $main_message = "You received the following message from your personal website at ".getdate()."\n\n"; $main_message.="Name: ".$sender_name."\n"; $main_message.="Sender's Email: ".$sender_email."\n"; $main_message.="Message: ".$sender_message."\n"; //send the email to myself. @mail($email_to, $email_subject, $main_message); ?> Oh, and the site is www.personal.psu.edu/mrs5171/index.php. Any help would be awesome! -Marvin Quote Link to comment https://forums.phpfreaks.com/topic/211135-php-email-form-button-not-working/ Share on other sites More sharing options...
MadTechie Posted August 19, 2010 Share Posted August 19, 2010 this HTML is over the top of it, so you can't click on the button (in FF) <div style="position: absolute; left: 4%; top: 40%; width: 100%; height: 500px;" id="mainbody2" class="bodytext"><br></div> remove that html and it should be fine Quote Link to comment https://forums.phpfreaks.com/topic/211135-php-email-form-button-not-working/#findComment-1101136 Share on other sites More sharing options...
Marvin0410 Posted August 19, 2010 Author Share Posted August 19, 2010 Thank you very much! I have removed the div, and it works like a charm! Thanks again, it's nice to know that this forum is nice to PHP noobies who want to learn more Quote Link to comment https://forums.phpfreaks.com/topic/211135-php-email-form-button-not-working/#findComment-1101378 Share on other sites More sharing options...
Marvin0410 Posted August 19, 2010 Author Share Posted August 19, 2010 Sorry, I just tried it again...that div tag is actually separate from the form...the form is (supposed) to be inserted into the div labeled "mainbody" as html using Javascript...basically, it's supposed to be one div and the form inside of it. I'm thinking it's a problem with my form itself, or the PHP...but I'm really not sure =/ Quote Link to comment https://forums.phpfreaks.com/topic/211135-php-email-form-button-not-working/#findComment-1101423 Share on other sites More sharing options...
MadTechie Posted August 20, 2010 Share Posted August 20, 2010 No the position is absolute and 40% from the top that is putting on top of the button, the form is fine, the code look okay as well Quote Link to comment https://forums.phpfreaks.com/topic/211135-php-email-form-button-not-working/#findComment-1101465 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.