Question:
php email form problem?
JACK!!!!!
2009-01-04 10:20:37 UTC
creating a php form and have some problems. i have tried it on my website server and when i submit it i only get the message box at the bottom and rest of the form is not there. here is the code -







EuropeXtreme - Talent Hunt Form









 
EUROPEXTREME
TALENT HUNT FORM

Please Fill in the Form below and click submit at
the bottom of the page.



Name:


Country:

Email:

Gamertag:

 



Which platform's do you own?:

How often do you use the console's)?:

How many clans have you been in (if any)?:

What is your favourite game for each console that you own?:

How many hours a week do you play online for each console that you own?:

Do you have your gamercard linked to href="http://www.callofduty.com">www.callofduty.com?:



Any Other Information?:







EuropeXtreme.com - 2009

Form Created By Jack Hampson








thanks
Three answers:
King Admiral
2009-01-06 16:20:46 UTC
I agree with Tom on this one, the sendmail.php should be straight forward, your variables in sendmail should relate to your element input names in your html form, so for example;



< ?php

$country = $_POST['country'] ; //get the country

$email = $_POST['email'] ; //get the returned email

// do this for all elements you require



//i would recommend having a $message variable and use it

//to contain all the info you want sent, then pass that to the sendmail

// rather than having lots of variables passed to the mail function e.g.



$message = " From: $name \n

Country: $country \n

etc";



mail("example@example.com", $subject, $message, $from);



?>



The thank you and validation are pretty straight forward, i would recommend using if mx exist for email to make sure users provide a real email address and not just one that passes your validation structure for a valid email, there is plenty of documentation on how to do it out there.
CornishNerd
2009-01-06 03:28:04 UTC
Good old sendmail......



That's not php, it's all just plain HTML



It does call in the php file sendmail.php in line 6 or 7





make sure you have uploaded sendmail.php, make sure you have edited it to include you own email address for it to send to etc and that should be about it. I believe you can also make a thank you page in sendmail.php that you can then redirect the users to once they have submitted.



Then you wanna get into form validation with Ajax so it remembers their entries and doesnt refresh the whole page if they make a mistake :o ;)
?
2016-10-21 08:34:43 UTC
one ingredient i spotted appropriate to the Hypertext Preprocessor code that takes the innovations from the form and tactics it is which you probably did no longer contain the submit variables interior the code once you're retaining the variables which you would be working with interior the Hypertext Preprocessor code. for the reason which you chosen to deliver the information utilising a submit technique, you need to be "receiving" it on the Hypertext Preprocessor website utilising a submit variable, then storing the fee of that submit variable right into a "popular" variable, which you create. So, as a replace of having something like: // touch situation $situation ="$situation"; // info $message="$element"; you ought to exchange the fee which you're placing the $situation variable to right into a submit variable, which could have the information from the HTML form which you have have been given created. additionally, the component of the submit variable that is going interior the brackets must be despite the "call" characteristic grow to be equivalent to which you used on your HTML form. The above code, with the 2d variable being replaced right into a submit variable, ought to look something like this: // touch situation $situation = $_POST['situation']; // info $message=$_POST['element']; Now, your $situation variable ought to contain the fee of despite the consumer entered for the situation of the e-mail, as you're truly taking it from the submit variable and storing it in a sparkling variable which you created. to verify that this to artwork with each and every of the climate of the form, even nonetheless, you may ought to alter the different variables that are taking records from the HTML form to submit variables on your Hypertext Preprocessor code, like we did above for it to artwork. solid luck and that i'm hoping I helped you!


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...