Chikwado Posted April 9, 2015 Share Posted April 9, 2015 Some one check this: My contactus form does not work. After clicked submit it does not return any alert or deliver the message. These file can be found here. http://chiquado.site90.net/project Are there any where I can read more tutorials? Some one help. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 9, 2015 Share Posted April 9, 2015 Look at your browser's developer tools, one of your files is not found and is redirecting to some page from your host. You should always use your developer tools to check for things like this. Link to comment Share on other sites More sharing options...
Chikwado Posted April 9, 2015 Author Share Posted April 9, 2015 (edited) Are there a modify options for it, Or do I have to contact the hosting company to take a look at it?. Edited April 9, 2015 by Chikwado Link to comment Share on other sites More sharing options...
Christopher.Burkhouse Posted April 9, 2015 Share Posted April 9, 2015 (edited) The error seems to be here: <script type="text/javascript" src="http://stats.hosting24.com/count.php"></script> If you check the logs, it displays an error saying it could not retrieve the page. Are you using a custom script or a third party script? It seems like http://stats.hosting24.com/count.php loads fine if you access it with your web browser, so I'm wondering if they disallow external websites to access this page, or if you yourself have it setup as such on accident. -Chris Edited April 9, 2015 by Christopher.Burkhouse Link to comment Share on other sites More sharing options...
justsomeguy Posted April 9, 2015 Share Posted April 9, 2015 Are there a modify options for it, Or do I have to contact the hosting company to take a look at it?.For what? What is "it"?The error seems to be here:That's just tracking code for the free web host, they inject the script tag at the end of the page to track usage or whatever. Link to comment Share on other sites More sharing options...
Christopher.Burkhouse Posted April 9, 2015 Share Posted April 9, 2015 @justsomeguy Oh you're right lol. I was a bit tired and missed the obvious comments. @Chikwado I forgot to mention, regardless of whether it's a custom or premade script, you're providing us with nothing here. We'd need to be able to see form_handler.php in a case where there are no errors. You're not even telling us what the expected results are. Is it supposed to echo text? Is an email actually sent but no text displayed? We need details in order to help. The best way to do this would be by providing your the PHP code in form_handler.php so we can see what's going on, and help from there, unless I'm misunderstanding the situation. -Chris Link to comment Share on other sites More sharing options...
Techneut Posted April 10, 2015 Share Posted April 10, 2015 Yh, i agree with Christoper.Burkhouse. Without the code no one can help you. Link to comment Share on other sites More sharing options...
Chikwado Posted April 10, 2015 Author Share Posted April 10, 2015 (edited) The following are the php code: <!DOCTYPE html> <html> <body> <?php //Recipient recipient = "info@chiquado.site90.net"; //Get user input $name = $_GET["fname"]; $name = $_GET["lname"]; mail($recipient, $fname, $lname); echo "mail sent"; ?> </body> </html> Although my form has 4 input field with one radio button. I was testing 2 field. The above php has extension as: form_handler.php html form action has: form_handler.php Then if html code is needed I will show it. Thanks. Edited April 10, 2015 by Chikwado Link to comment Share on other sites More sharing options...
justsomeguy Posted April 10, 2015 Share Posted April 10, 2015 Look at the manual for the mail function:http://php.net/manual/en/function.mail.phpThe required parameters are to, subject, and message. $name = $_GET[fname];$name = $_GET["lname"];One of those is quoted, and one of them is not. And you're saving both in a variable called $name. mail($recipient, $fname, lname);You have no variables called $fname or $lname (and you left out the $).Add this to the top of your PHP code: ini_set('display_errors', 1);error_reporting(E_ALL); Link to comment Share on other sites More sharing options...
Chikwado Posted April 10, 2015 Author Share Posted April 10, 2015 Sorry, I was in a hurry mood while posting those code, I have edited it now. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 10, 2015 Share Posted April 10, 2015 Did you look at the documentation for the mail function? You're not using it correctly. Link to comment Share on other sites More sharing options...
Christopher.Burkhouse Posted April 11, 2015 Share Posted April 11, 2015 If the documentation is confusing, then also look at the samples provided. They are very clear. If it still doesn't make sense, let us know which part you're stuck on. A big part of learning PHP is using the documentation and resources available, which justsomeguy gave you a direct link to. Also, note that you can do the following: if(mail($e,$s,$m)) echo 'Email sent successfully';else echo 'Error sending email.'; As opposed to assuming it was sent successfully just because it didn't error out. As stated, mail returns true if successful, otherwise returns false. Link to comment Share on other sites More sharing options...
Chikwado Posted April 11, 2015 Author Share Posted April 11, 2015 This file is redirecting to another page, Every php file will excute or return error. For example: http://chiquado.site90.net/magazine. if you choose a file to upload it return error as it can not excute. I have try all the way on crafting my code. Link to comment Share on other sites More sharing options...
Chikwado Posted April 12, 2015 Author Share Posted April 12, 2015 (edited) I am sorry for all that mistake, It's just the way I am working hard over it without progress. This is the code: <!DOCTYPE html> <html> <body> <form method="POST" action="<?php echo $_SERVER ['PHP_SELF']; ?>"> FirstName:<input type="text" name="fname"> LastName:<input type="text" name="lname"> Email:<input type="text" name="email"> Phone:<input type="text" name="phone"> Message:<input type= "textarea" id="txt" name="message"> Male:<input type="radio" name="radioa"> Female:<input type= "radio" name="radiob"> <input type="submit" value="Submit"> </form> <?php $to = 'info@chiquado.site90.net'; if($_SERVER["REQUEST_METHOD"] =="POST") { $anameone = $_POST['fname']; $bnametwo = $_POST['lname']; $cnamethree = $_POST['email']; $dnamefour = $_POST['phone']; $enamefive = $_POST['message']; $fnamesix = $_POST['radioa']; $gnameseven = $_POST['radiob']; if(mail($to, $subject, $message)) { echo 'mail sent'; }else{ echo 'mail not sent'; } } </body> </html> Edited April 13, 2015 by Chikwado Link to comment Share on other sites More sharing options...
Techneut Posted April 13, 2015 Share Posted April 13, 2015 Why are you assigning one variable ($name) to all the fields. Can you name each input field differently. Link to comment Share on other sites More sharing options...
justsomeguy Posted April 13, 2015 Share Posted April 13, 2015 I don't know how you're pasting your code in here, but it's a lot easier to read when you only have 1 code box instead of 1 box per line. <!DOCTYPE html><html><body><form method="POST"action="<?php echo $_SERVER['PHP_SELF']; ?>">FirstName:<input type="text" name="fname">LastName:<inputtype="text" name="lname">Email:<input type="text" name="email">Phone:<input type="text"name="phone">Message:<input type="textarea" id="txt" name="message">Male:<input type="radio"name="radioa">Female:<input type="radio" name="radiob"><input type="submit"value="Submit"></form><?php$to = 'info@chiquado.site90.net';if($_SERVER["REQUEST_METHOD"] =="POST"){$anameone = $_POST['fname'];$bnametwo = $_POST['lname'];$cnamethree = $_POST['email'];$dnamefour = $_POST['phone'];$enamefive = $_POST['message'];$fnamesix = $_POST['radioa'];$gnameseven = $_POST['radiob'];if(mail($to, $subject, $message)) {echo 'mail sent';}else{echo 'mail not sent';}}</body></html>When you call the mail function you're trying to send variables called $subject and $message, but they aren't defined. You aren't doing anything with the data from the form either. Link to comment Share on other sites More sharing options...
Chikwado Posted April 14, 2015 Author Share Posted April 14, 2015 Yes! My stuff is now working, I was doing a different thing not actually what I wanted. The link is here http://chiquado.site90.net/myform.php. Thank you all for help and support. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now