MikeyKs1 Posted June 7, 2011 Share Posted June 7, 2011 Hello, I found some usefull code here and cant figure out what I done wrong. I am trying to produce form-mail that will email me any submitted brithday. Please help!! Thanks This is my index.php file <?php $monthOptions = ''; $dayOptions = ''; $yearOptions = ''; for($month=1; $month<=12; $month++) { $monthName = date("M", mktime(0, 0, 0, $month)); $monthOptions .= "<option value=\"{$month}\">{$monthName}</option>\n"; } for($day=1; $day<=31; $day++) { $dayOptions .= "<option value=\"{$day}\">{$day}</option>\n"; } for($year=1996; $year<=2011; $year++) { $yearOptions .= "<option value=\"{$year}\">{$year}</option>\n"; } ?> <html> <head> <script type="text/javascript"> function updateDays() { //Create variables needed var monthSel = document.getElementById('month'); var daySel = document.getElementById('day'); var yearSel = document.getElementById('year'); var monthVal = monthSel.value; var yearVal = yearSel.value; //Determine the number of days in the month/year var daysInMonth = 31; if (monthVal==2) { daysInMonth = (yearVal%4==0 && (yearVal%100!=0 || yearVal%400==0)) ? 29 : 28; } else if (monthVal==4 || monthVal==6 || monthVal==9 || monthVal==11) { daysInMonth = 30; } //Add/remove options from days select list as needed if(daySel.options.length > daysInMonth) { //Remove excess days, if needed daySel.options.length = daysInMonth; } while (daySel.options.length != daysInMonth) { //Add additional days, if needed daySel.options[daySel.length] = new Option(daySel.length+1, daySel.length+1, false); } return; } </script> </head> <body> <form name="Birthday" method="post" action="post.php"> Birthdate: <select name="month" id="month" onChange="updateDays();"> <?php echo $monthOptions; ?> </select> <select name="day" id="day"> <?php echo $dayOptions; ?> </select> <select name="year" id="year" onChange="updateDays();"> <?php echo $yearOptions; ?> </select> </form> <div style="padding-top: 5px"><input type="submit" name="Submit" value="Submit" style="font-family: Tahoma, Geneva, sans-serif" style="font-size: 10px"></div> </body> </html> This is my post.php file <?php // Receiving variables @$month = addslashes($_POST['month']); @$day = addslashes($_POST['day']); @$year = addslashes($_POST['year']); //Sending Email to form owner $pfw_header = "From: VBS\n" . "Reply-To: VBS\n"; $pfw_subject = "VBS"; $pfw_email_to = "your@email.net"; $pfw_message = "Birthday: $month $day $year\n"; @mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ; echo("<p align='center'><font face='Arial' size='3' color='#FF0000'>fixed</font></p>"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/238683-birthday-script/ Share on other sites More sharing options...
gristoi Posted June 7, 2011 Share Posted June 7, 2011 exactly what errors are you getting. is you error checking turned on? make sure you have error_reporting(E_ALL); ini_set('display_errors', '1'); at the top of your script. Quote Link to comment https://forums.phpfreaks.com/topic/238683-birthday-script/#findComment-1226529 Share on other sites More sharing options...
Maq Posted June 7, 2011 Share Posted June 7, 2011 I found some usefull code here and cant figure out what I done wrong What happens...? We need more detail of the issue. Quote Link to comment https://forums.phpfreaks.com/topic/238683-birthday-script/#findComment-1226530 Share on other sites More sharing options...
MikeyKs1 Posted June 7, 2011 Author Share Posted June 7, 2011 I get NO errors. When I click submit nothing happens. Quote Link to comment https://forums.phpfreaks.com/topic/238683-birthday-script/#findComment-1226538 Share on other sites More sharing options...
gristoi Posted June 7, 2011 Share Posted June 7, 2011 your submit button is outside of the form tag. move it inside: </form> <div style="padding-top: 5px"><input type="submit" name="Submit" value="Submit" style="font-family: Tahoma, Geneva, sans-serif" style="font-size: 10px"></div> should be: <div style="padding-top: 5px"><input type="submit" name="Submit" value="Submit" style="font-family: Tahoma, Geneva, sans-serif" style="font-size: 10px"></div> </form> Quote Link to comment https://forums.phpfreaks.com/topic/238683-birthday-script/#findComment-1226540 Share on other sites More sharing options...
MikeyKs1 Posted June 7, 2011 Author Share Posted June 7, 2011 Somethng so simple I just could not see it. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/238683-birthday-script/#findComment-1226545 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.