Jump to content

abdulkareem

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by abdulkareem

  1. well, i uploaded the form to a server. the sending process works well but the big problem is that it doesnt pick the details from the from. an empty email is sent to the recipient mail. could anyone program the form according to his/her knowledge so that it picks the form details?
  2. THE HTML FORM; form.html <form name="myform" action="process.php" method="POST"> <input type="hidden" name="check_submit" value="1" /> Name: <input type="text" name="Name" /><br /> From: <input type="text" name="from" /><br /> Select something from the list: <select name="Seasons"> <option value="Spring" selected="selected">Spring</option> <option value="Summer">Summer</option> <option value="Autumn">Autumn</option> <option value="Winter">Winter</option> </select><br /><br /> Choose one: <input type="radio" name="Country" value="USA" /> USA <input type="radio" name="Country" value="Canada" /> Canada <input type="radio" name="Country" value="Other" /> Other <br /> Choose the colors: <input type="checkbox" name="Colors[]" value="green" checked="checked" /> Green <input type="checkbox" name="Colors[]" value="yellow" /> Yellow <input type="checkbox" name="Colors[]" value="red" /> Red <input type="checkbox" name="Colors[]" value="gray" /> Gray <br /><br /> Comments:<br /> <textarea name="Comments" rows="10" cols="60">Enter your comments here</textarea><br /> <input type="submit" name="submit" value="submit"/> </form> process.php <?php //Check whether the form has been submitted if (array_key_exists('submit', $_POST)) {//the submit button was named submit, unless you changed it? //Converts the new line characters (\n) in the text area into HTML line breaks (the <br /> tag) $_POST['Comments'] = nl2br($_POST['Comments']); //Check whether a $_GET['Languages'] is set<-Your not checking a $_GET if ( isset($_POST['Colors']) ) { //your just putting all the Array values into one key here, so still an array really... $_POST['Colors'] = implode(', ', $_POST['Colors']); //Converts an array into a single string } //So your echoing the details being submitted, fine... //Let's now print out the received values in the browser echo "Your name: {$_POST['Name']}<br />"; echo "from: {$_POST['from']}<br />"; echo "Your favourite season: {$_POST['Seasons']}<br /><br />"; echo "Your comments:<br />{$_POST['Comments']}<br /><br />"; echo "You are from: {$_POST['Country']}<br />"; echo "Colors you chose: {$_POST['Colors']}<br />"; //pop the mail function here, set the headers and send mail("info@youremail.com", 'online form',$comments,"from: $from"); } else { //have the error handler here so that you keep traffic, and nothing is more annoying than a static //error message really? header("location: form.html"); exit; //kill the script here so that nothing else can be invoked by php... always handy } ?> well, i uploaded the form to a server. the sending process works well but the big problem is that it doesnt pick the details from the from. an empty email is sent to the recipient mail. could anyone program the form according to his/her knowledge so that it picks the form details?
  3. at "rwwd" thanks for the correction <input type="submit" name="submit" value="submit"/> the process.php file looks like this... <?php //Check whether the form has been submitted if (array_key_exists('check_submit', $_POST)) { //Converts the new line characters (\n) in the text area into HTML line breaks (the <br /> tag) $_POST['Comments'] = nl2br($_POST['Comments']); //Check whether a $_GET['Languages'] is set if ( isset($_POST['Colors']) ) { $_POST['Colors'] = implode(', ', $_POST['Colors']); //Converts an array into a single string } //Let's now print out the received values in the browser echo "Your name: {$_POST['Name']}<br />"; echo "Your password: {$_POST['Password']}<br />"; echo "Your favourite season: {$_POST['Seasons']}<br /><br />"; echo "Your comments:<br />{$_POST['Comments']}<br /><br />"; echo "You are from: {$_POST['Country']}<br />"; echo "Colors you chose: {$_POST['Colors']}<br />"; } else { echo "You can't see this page without submitting the form."; } ?> what i would like is the form to send the details to an email address.
  4. Hi, am having abit of a problem.Can anyone help me in programming my form to send it's details to an email address.The form should be able to detect unfilled fields,unselected items all in all the form should work as a effectively according to how i designed it The email sending processing should be handled by a separate file known as process.php below is the HTML coding... <form name="myform" action="process.php" method="POST"> Name: <input type="text" name="Name" /><br /> Email: <input type="text" name="Email" /><br /> Select something from the list: <select name="Seasons"> <option value="Spring" selected="selected">Spring</option> <option value="Summer">Summer</option> <option value="Autumn">Autumn</option> <option value="Winter">Winter</option> </select><br /><br /> Choose one: <input type="radio" name="Country" value="USA" /> USA <input type="radio" name="Country" value="Canada" /> Canada <input type="radio" name="Country" value="Other" /> Other <br /> Choose the colors: <input type="checkbox" name="Colors[]" value="green" checked="checked" /> Green <input type="checkbox" name="Colors[]" value="yellow" /> Yellow <input type="checkbox" name="Colors[]" value="red" /> Red <input type="checkbox" name="Colors[]" value="gray" /> Gray <br /><br /> Comments:<br /> <textarea name="Comments" rows="10" cols="60">Enter your comments here</textarea><br /> <input type="submit" /> </form>
  5. hi to all. glad to join php freaks. i'm new to php hoping to gain alot from this site.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.