_shad_ Posted February 12, 2010 Share Posted February 12, 2010 I have written the following scripts: <html> <head> <?php include 'config.php'; include 'if.php'; $required = '<font color="'.$reqclr.'">'.$reqsym.'</font>'; $title = '<font color="'.$titleclr.'" size="'.$titlesize.'">'.$titletxt.'</font>'; ?> <script type="text/javascript" src="scripts.js"></script> <title> <?php echo $titletxt; ?> </title> <style type="text/css"> @import url('style.css'); </style> </head> <body> <center> <?php echo $title; ?> <br> <br> <font class="Disclaimer"> <?php echo $disclaim; ?> </font> <br> </center> <form method="post" action="mailer.php" name="application"> <center> <table class="table_main"> <tr> <td colspan=2> <font class="main_text"> Please fill out this form with your correct information: </font> </td> </tr> <tr> <td> <?php echo $required; ?> <font class="required_label"> Your E-Mail: </font> </td> <td> <input type="text" size="<?php echo $txinsize; ?>" name="applicant_email"> </td> </tr> <tr> <td> <?php echo $required; ?> <font class="required_label"> Full real name: </font> </td> <td> <input name="Name" size="<?php echo $txinsize; ?>"> </td> </tr> <tr> <td> <?php echo $required; ?> <font class="required_label"> DJ Name: </font> </td> <td> <input name="x" size="<?php echo $txinsize; ?>" > </td> </tr> <tr> <td> <?php echo $required; ?> <font class="required_label"> Age: </font> </td> <td> <input size="<?php echo $txinsize; ?>" name="age"> </td> </tr> <tr> <td> <?php echo $required; ?> <font class="main_text"> Location: </font> </td> <td> <input size="<?php echo $txinsize; ?>" name="location"> </td> </tr> <tr> <td> <?php echo $required; ?> <font class="main_text"> IM Address: </font> </td> <td> <input size="<?php echo $txinsize; ?>" name="imid"> </td> </tr> <tr> <td colspan=2> <?php echo $required; ?> <ol type="I"> <font class="count"><li></font><font class="main_text"> Have you ever been a DJ anywhere else?:<br> If yes, please list all of the stations you worked for and why you left:</font><br> <textarea name="question1" name="q1" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea><br> <font class="count"><li></font><font class="main_text"> Hours spent online per week: </font> <br> <textarea name="question16" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea><br> <font class="count"><li></font> <font class="main_text"> Time of day you are usually online: </font> <br> <textarea name="question2" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> Type of music you like: </font> <br> <textarea name="question3" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> What shift are you applying for (if hired you may not receive the shift)? </font> <br> <textarea name="question4" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> Do you currently have a microphone? </font> <br> <textarea name="question5" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> Would help in any way you can? </font> <br> <textarea name="question6" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> Will you be willing to attend meetings (online) when scheduled? </font> <br> <textarea name="question7" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> Are you currently employed? </font> <br> <textarea name="question8" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> If Yes, What is your profession? </font> <br> <textarea name="question9" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> What type of internet connection and speed do you have? </font> <br> <textarea name="question10" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> How big Hard Disc and Memory does your computer have? </font> <br> <textarea name="question11" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> Tell us some more about yourself (interests, hobbies, etc) anything you would like for us to know about yourself. </font> <br> <textarea name="question12" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> Why do you want to DJ for our Radio? </font> <br> <textarea name="question13" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> Where did you hear about our Radio Station? </font> <br> <textarea name="question14" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> <font class="count"><li></font> <font class="main_text"> What do you think you could bring to our station that we don't already have? </font> <br> <textarea name="question15" cols="<?php echo $txtacols; ?>" rows="<?php echo $txtrows; ?>"></textarea> <br> </ol> </td> </tr> <tr> <td colspan=2 align=center> <input type=submit name="send" value="Submit" onClick="warn(); return false"> <input type="reset" value="Clear" onClick="erase(); return false"> </td> </tr> <tr> <td colspan=2 align=center> <small>A <font color=red><?php echo $required; ?></font> indicates a field is required</small> </td> </tr></ol> </table> </form> </body> </html> and <?php include 'config.php'; $appemail = $_REQUEST['applicant_email']; $name = $_REQUEST['Name']; $djname = $_REQUEST['x']; $q1 = $_REQUEST['question1']; $q2 = $_REQUEST['question2']; $q3 = $_REQUEST['question3']; $q4 = $_REQUEST['question4']; $q5 = $_REQUEST['question5']; $q6 = $_REQUEST['question6']; $q7 = $_REQUEST['question7']; $q8 = $_REQUEST['question8']; $q9 = $_REQUEST['question9']; $q10 = $_REQUEST['question10']; $q11 = $_REQUEST['question11']; $q12 = $_REQUEST['question12']; $q13 = $_REQUEST['question13']; $q14 = $_REQUEST['question14']; $q15 = $_REQUEST['question15']; $q16 = $_REQUEST['question16']; $imid = $_REQUEST['imid']; $location = $_REQUEST['location']; $age = $_REQUEST['age']; $headers = "From: $appemail"; $subject = "DJ Application"; $fields = array(); $fields{"Name"} = "\n Name"; $fields{"djname"} = "\n Dj Name"; $fields{"age"} = "\n Age"; $fields{"location"} = "\n Location"; $fields{"imid"} = "\n IM Address"; $fields{"q1"} = "\n Have you ever been a DJ anywhere else? \n If yes, please list all of the stations you worked for and why you left\n"; $fields{"q2"} = "\n Hours spent online per week:\n"; $fields{"q3"} = "\n Time of day you are usually online \n"; $fields{"q4"} = "\n Type of music you like \n"; $fields{"q5"} = "\n What shift are you applying for (if hired you may not receive the shift)? \n"; $fields{"q6"} = "\n Do you currently have a microphone? \n"; $fields{"q7"} = "\n Would help in any way you can? \n"; $fields{"q8"} = "\n Will you be willing to attend meetings (online) when scheduled? \n"; $fields{"q9"} = "\n Are you currently employed? \n"; $fields{"q10"} = "\n If Yes, What is your profession? \n"; $fields{"q11"} = "\n What type of internet connection and speed do you have? \n"; $fields{"q12"} = "\n How big Hard Disc and Memory does your computer have? \n"; $fields{"q13"} = "\n Tell us some more about yourself (interests, hobbies, etc) anything you would like for us to know about yourself. \n"; $fields{"q14"} = "\n Why do you want to DJ for our Radio? \n"; $fields{"q15"} = "\n Where did you hear about our Radio Station? \n"; $fields{"q16"} = "\n What do you think you could bring to our station that we don't already have? \n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); } $headers2 = "From: [email protected]"; $subject2 = "Thank you for applying!"; $autoreply = "We appriciate your interest in our company."; if($appemail == '') {print "You have not entered an email, please go back and try again";} else { if($name == '') {print "You have not entered a name, please go back and try again";} else { $send = mail($recip, $subject, $body, $headers); $send2 = mail($appemail, $subject2, $autoreply, $headers2); if($send) {header( "Location: thankyou.php" );} else {print "We encountered an error sending your mail, please notify [email protected]"; } } } ?> The problem is that the variables wont transfer from the first script (index.php) to the second script (mailer.php) so when I get the e-mails they have all the questions but are empty. Quote Link to comment https://forums.phpfreaks.com/topic/191916-variable-transfer/ Share on other sites More sharing options...
p2grace Posted February 12, 2010 Share Posted February 12, 2010 Not knowing exactly how your code is structured, you best bet is to probably save the data into session variables, and then call the session variables in your mailer. Quote Link to comment https://forums.phpfreaks.com/topic/191916-variable-transfer/#findComment-1011544 Share on other sites More sharing options...
PFMaBiSmAd Posted February 12, 2010 Share Posted February 12, 2010 Umm. The names of your $_REQUEST variables don't match the index names of the $fields array. Edit, also the syntax for the $fields array elements is incorrect so they probably don't exist anyway. Quote Link to comment https://forums.phpfreaks.com/topic/191916-variable-transfer/#findComment-1011545 Share on other sites More sharing options...
_shad_ Posted February 12, 2010 Author Share Posted February 12, 2010 Umm. The names of your $_REQUEST variables don't match the index names of the $fields array. Edit, also the syntax for the $fields array elements is incorrect so they probably don't exist anyway. wow, had no idea but I changed it and it works. Thank you so much! Quote Link to comment https://forums.phpfreaks.com/topic/191916-variable-transfer/#findComment-1011549 Share on other sites More sharing options...
_shad_ Posted February 12, 2010 Author Share Posted February 12, 2010 Not knowing exactly how your code is structured, you best bet is to probably save the data into session variables, and then call the session variables in your mailer. Thank you for the advice! Quote Link to comment https://forums.phpfreaks.com/topic/191916-variable-transfer/#findComment-1011550 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.