PHP - Redirect After Correct Form Input
hey,
I'm working on a contact form. The form is being checked on correct values. If not completed correctly, the form shows again with a warning at the wrong or forgotten fields and the right fields remain fild in. After submitting with correct inputdata, there is a message shown in the same page saying "thank you, we'll contact you as fast as possible,...". But I would like to redirect the page to the homepage about 5 seconds after the message is being shown. This is the form header part: <form method="post" action="' .$_SERVER['REQUEST_URI'] . '" /> How can I make this form say "thank you" when the values are right (in the same page or another, that doesn't really matter) and then make it jump to the homepage again? thanks in advance Similar TutorialsI cannot redirect to other page even I enter correct information and recaptcha in activation form. Anyone who can check what going wrong in my activation script?
Here is my php activation check script:
<?php Hello PHP Freaks forum, I am a beginner in web development and seem to be understanding it very quickly, but there is one thing that is putting this into some halt. I have this code right here, what I want to do is have a "riddle site", where if you answer the riddle correctly, it redirects you to another page (in other words to the next riddle). Object: If correct, give access to next page. If incorrect, stay on page and print "Incorrect". I've tried to start on it, but the way how HTML and PHP don't mix very well, I feel like in the middle of an ocean feeling helpless. <html> <head> <title>PHP Test</title> </head> <body> <p> <font face="Courier New">ZnJ5cyBwYmFnbnZhcnEgaGFxcmVqbmdyZSBvZXJuZ3V2YXQgbmNjbmVuZ2hm</font> </p> CLUE: The base is rotated <br/></body> <form action="index-5.php" method="post"> Answer: <input type="text" name="number" /><br /> </select> <input name="submit" type="submit"> </form> <?php if(isset($_POST['submit'])){ $number = $_POST['number']; if ($number == "scuba"){ echo "CORRECT";} } ?> </html> If possible, can you give me an explanation how to do it and a sample of it as well? Thanks, Gldnbr Hi people, I really hope you guys can help me out today. I'm just a newbe at php and i'm having real trouble. Bassically all I want to do is have a user type in a company name in a html form. If what the user types in the form matches the company name in my php script i want the user to be sent to another page on my site. If what the user types in the form doesnt match the company name in my php script i want the user to be sent to a differnt page like an error page for example. this is my html form: Code: [Select] <form id="form1" name="form1" method="post" action="form_test.php"> <p>company name: <input type="text" name="company_name" id="company_name" /> </p> <p> <input type="submit" name="button" id="button" value="Submit" /> </p> </form> And this is the php code I'm trying to process the information on: Code: [Select] <?php $comp_name = abc; if(isset ($_POST["company_name"])){ if($_POST["company_name"] == $comp_name){ header("Location: http://www.hotmail.com"); exit(); } else{ header("Location: http://www.yahoo.com"); exit(); } } ?> The thing is i'm getting this error when i test it: Warning: Cannot modify header information - headers already sent by (output started at D:\Sites\killerphp.com\form_test.php:10) in D:\Sites\killerphp.com\form_test.php on line 17 Please can some one help me out, i'm sure this is just basic stuff but i just cant get it to work Cheers. <form action="blabla"> <input type="hidden" name="user" value="<?php echo $player;?>"> </form or <input type="hidden" name="user" value=<?php echo $player;?>> or are they both wrong ^_^ It's pretty simple to see what I am trying to do here. For some reason all results in the table are the same exact cityName replacing all existing records. The echoed results are correct. I've include a small dump of my table as well. $query = "SELECT cityName FROM sys_city_dev_2"; $resource = mysqli_query($cxn, $query) or die("MySQL error: " . mysqli_error($cxn) . "<hr>\nQuery: $query"); while($result = mysqli_fetch_assoc($resource)) { $nox = $result['cityName']; $toUpper = ucfirst($nox); echo "$toUpper" . "<br />"; $setString = "UPDATE sys_city_dev_2 SET cityName = '" . $toUpper ."' WHERE cityName != ''"; mysqli_query($cxn,$setString); } 100 Records of table dump (pre running my script above): -- -- Table structure for table `sys_city_dev_2_backup` -- CREATE TABLE IF NOT EXISTS `sys_city_dev_2_backup` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Mid` int(11) NOT NULL DEFAULT '0', `cityName` varchar(30) NOT NULL DEFAULT '', `forder` int(4) NOT NULL DEFAULT '0', `disdplay` int(4) NOT NULL DEFAULT '0', `cid` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=113970 ; -- -- Dumping data for table `sys_city_dev_2_backup` -- INSERT INTO `sys_city_dev_2_backup` (`ID`, `Mid`, `cityName`, `forder`, `disdplay`, `cid`) VALUES (84010, 1, 'dothan', 0, 0, 0), (84011, 1, 'alabaster', 0, 0, 0), (84012, 1, 'birmingham', 0, 0, 0), (84013, 2, 'flagstaff', 0, 0, 0), (84014, 1, 'auburn', 0, 0, 0), (84015, 1, 'florence', 0, 0, 0), (84016, 1, 'gadsden', 0, 0, 0), (84017, 1, 'huntsville', 0, 0, 0), (84018, 1, 'mobile', 0, 0, 0), (84019, 1, 'montgomery', 0, 0, 0), (84020, 1, 'tuscaloosa', 0, 0, 0), (84021, 2, 'mohave valley', 0, 0, 0), (84022, 2, 'phoenix', 0, 0, 0), (84023, 2, 'prescott', 0, 0, 0), (84024, 2, 'sierra vista', 0, 0, 0), (84025, 2, 'tucson', 0, 0, 0), (84026, 2, 'yuma', 0, 0, 0), (84027, 3, 'bakersfield', 0, 0, 0), (84028, 3, 'chico', 0, 0, 0), (84029, 3, 'fresno / madera', 0, 0, 0), (84030, 3, 'gold country', 0, 0, 0), (84031, 3, 'humboldt county', 0, 0, 0), (84032, 3, 'imperial', 0, 0, 0), (84033, 3, 'inland empire', 0, 0, 0), (84034, 3, 'los angeles', 0, 0, 0), (84035, 3, 'alhambra', 0, 0, 0), (84036, 3, 'merced', 0, 0, 0), (84037, 49, 'fayetteville', 0, 0, 0), (84038, 49, 'fort smith', 0, 0, 0), (84039, 49, 'jonesboro', 0, 0, 0), (84040, 49, 'little rock', 0, 0, 0), (84041, 49, 'arkadelphia', 0, 0, 0), (84042, 49, 'texarkana', 0, 0, 0), (84043, 3, 'modesto', 0, 0, 0), (84044, 3, 'alta sierra', 0, 0, 0), (84045, 3, 'alpine', 0, 0, 0), (84046, 3, 'pedley', 0, 0, 0), (84047, 3, 'redding', 0, 0, 0), (84048, 3, 'alondra park', 0, 0, 0), (84049, 3, 'sacramento', 0, 0, 0), (84050, 4, 'canon city', 0, 0, 0), (84051, 3, 'san luis obispo', 0, 0, 0), (84052, 3, 'santa barbara', 0, 0, 0), (84053, 3, 'stockton', 0, 0, 0), (84054, 3, 'aliso viejo', 0, 0, 0), (84055, 3, 'visalia', 0, 0, 0), (84056, 3, 'yuba city', 0, 0, 0), (84057, 4, 'boulder', 0, 0, 0), (84058, 4, 'colorado springs', 0, 0, 0), (84059, 4, 'denver', 0, 0, 0), (84060, 4, 'applewood', 0, 0, 0), (84061, 4, 'pueblo', 0, 0, 0), (84062, 4, 'air force academy', 0, 0, 0), (84063, 5, 'avon', 0, 0, 0), (84064, 5, 'hartford', 0, 0, 0), (84065, 5, 'new haven', 0, 0, 0), (84066, 5, 'ansonia', 0, 0, 0), (84067, 5, 'fairfield', 0, 0, 0), (84068, 7, 'daytona beach', 0, 0, 0), (84069, 7, 'sebastian', 0, 0, 0), (84070, 5, 'wallingford center', 0, 0, 0), (84071, 8, 'belvedere park', 0, 0, 0), (84072, 7, 'sarasota springs', 0, 0, 0), (84073, 7, 'sandalfoot cove', 0, 0, 0), (84074, 7, 'san carlos park', 0, 0, 0), (84075, 7, 'st. augustine', 0, 0, 0), (84076, 7, 'tallahassee', 0, 0, 0), (84077, 7, 'safety harbor', 0, 0, 0), (84078, 7, 'ruskin', 0, 0, 0), (84079, 8, 'athens-clarke county', 0, 0, 0), (84080, 8, 'atlanta', 0, 0, 0), (84081, 8, 'augusta-richmond county', 0, 0, 0), (84082, 8, 'brunswick', 0, 0, 0), (84083, 8, 'columbus', 0, 0, 0), (84084, 8, 'americus', 0, 0, 0), (84085, 8, 'acworth', 0, 0, 0), (84086, 8, 'valdosta', 0, 0, 0), (84087, 10, 'boise', 0, 0, 0), (84088, 10, 'ammon', 0, 0, 0), (84089, 10, 'moscow', 0, 0, 0), (84090, 10, 'blackfoot', 0, 0, 0), (84091, 10, 'twin falls', 0, 0, 0), (84092, 10, 'meridian', 0, 0, 0), (84093, 10, 'jerome', 0, 0, 0), (84094, 10, 'idaho falls', 0, 0, 0), (84095, 11, 'addison', 0, 0, 0), (84096, 10, 'garden city', 0, 0, 0), (84097, 10, 'eagle', 0, 0, 0), (84098, 10, 'chubbuck', 0, 0, 0), (84099, 10, 'caldwell', 0, 0, 0), (84100, 12, 'bloomington', 0, 0, 0), (84101, 12, 'evansville', 0, 0, 0), (84102, 12, 'fort wayne', 0, 0, 0), (84103, 12, 'indianapolis', 0, 0, 0), (84104, 12, 'muncie / anderson', 0, 0, 0), (84105, 12, 'lafayette / west lafayette', 0, 0, 0), (84106, 12, 'south bend / michiana', 0, 0, 0), (84107, 12, 'terre haute', 0, 0, 0), (84108, 12, 'northwest indiana', 0, 0, 0), (84109, 13, 'ames', 0, 0, 0); Hi, I need to add a function for a date field on a form being submitted to MySQL DB. Something similar to this for a website field, except it shoudl make sure the format is in 01/05/2010 or 2numbers/2 numbers/4 numbers format... if(!mb_eregi("^[a-zA-Z0-9-#_.+!*'(),/&:;=?@]*$", $website)) $this->setError('website', 'invalid website'); elseif(mb_strlen(trim($website)) > 120) $this->setError('website', 'too long! 120 characters'); thanks in advance for any assistance. I have a calendar select date function for my form that returns the date in the calendar format for USA: 02/16/2012. I need to have this appear as is for the form and in the db for the 'record_date' column, but I need to format this date in mysql DATE format (2012-02-16) and submit it at the same time with another column name 'new_date' in the database in a hidden input field. Is there a way to do this possibly with a temporary table or something? Any ideas would be welcome. Doug I have read around and can't seem to find the right coding for what I need on this forum and some other other forums. I have a contact form (as listed below) and I need 2 locations (Print Name and Title) fields to auto-populate on a separate form (can be a doc, pdf, etc. any form of document which is easiest) and this form can be totally back end and the individual using the form never is going to see the form. It's going on a contract form, that we would like to auto-populate. Also is there a simple attachment code so individuals can attach documents to the code? <p style: align="center"><form action="mailtest.php" method="POST"> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input type="hidden" name="ip" value="<?php echo $ipi ?>" /> <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" /> <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" /> <div align="center"> <p class="style1">Name</p> <input type="text" name="name"> <p class="style1">Address</p> <input type="text" name="address"> <p class="style1">Email</p> <input type="text" name="email"> <p class="style1">Phone</p> <input type="text" name="phone"> <p class="style1">Debtor</p> <input type="text" name="debtor"> <p class="style1">Debtor Address</p> <input type="text" name="debtora"> <br /> <br /> <a href="authoforms.php" target="_blank" style="color:#ffcb00" vlink="#ffcb00">Click here to view Assignment Agreement and Contract Agreement</a> <p class="style1"><input type='checkbox' name='chk' value='I Have read and Agree to the terms.'> I have read and agree to the Assignment and Contract Agreement <br></p> <p class="style1">Print Name</p> <input type="text" name="pname"> <p class="style1">Title</p> <input type="text" name="title"> <p class="style1">I hear by agree that the information I have provided is true, accurate and the information I am submitting is <br /> not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms:</p> <select name="agree" size="1"> <option value="Agree">Agree</option> <option value="Disagree">Disagree</option> </select> <br /> <br /> <p class="style1">Employee ID:</p> <input type="text" name="employee"> <br /> <input type="submit" value="Send"><input type="reset" value="Clear"> </div> </form> </p> The mailtest php is this ?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $name = $_POST['name']; $address = $_POST['address']; $email = $_POST['email']; $phone = $_POST['phone']; $debtor = $_POST['debtor']; $debtora = $_POST['debtora']; $value = $_POST['chk']; $pname = $_POST['pname']; $title = $_POST['title']; $agree = $_POST['agree']; $employee = $_POST['employee']; $formcontent=" From: $name \n Address: $address \n Email: $email \n Phone: $phone \n Debtor: $debtor \n Debtor's Address: $debtora \n 'Client' has read Assignment and Contract Agreement: $value \n Print Name: $pname \n Title: $title \n I hear by agree that the information I have provided is true, accurate and the information I am submitting is not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms: $agree \n \n Employee ID: $employee \n IP: $ip"; $recipient = "mail@crapower.com"; $subject = "Online Authorization Form 33.3%"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!" . " -" . "<a href='index.php' style='text-decoration:none;color:#ffcb00;'> Return Home</a>"; $ip = $_POST['visitoraddress'] ?> Hi
I am trying to check whether all the form has been filled in in a questionaire on my site.
If any entry has not been made I want it to re-present the script for the form again.
I have tried this, but it runs the form whatever the state.
<?php session_start(); $_SESSION['Test']=$_POST['VID']; print_r ($_POST); $mail = $_POST['email']; $Vrate = $_POST['rate']; $Verse_imp = $_POST['Vimp']; $site_sug = $_POST['site']; $Site_imp = $_POST['Simp']; if (empty($email)) { echo '$mail is either 0, empty, or not set at all'; require('questionnaire.html'); } if (empty($Vrate)) { echo '$Vrate is either 0, empty, or not set at all'; require('questionnaire.html'); } if (empty($Verse_imp)){ echo '$Verse_imp is either 0, empty, or not set at all'; require('questionnaire.html'); } if (empty($site_sug)) { echo '$site_sug is either 0, empty, or not set at all'; require('questionnaire.html'); } if (empty($Site_imp)) { echo '$Site_imp is either 0, empty, or not set at all'; require('questionnaire.html'); } ?>This is unfinished code thats why I have left the echos in. Before I add the require it detected the empty line OK. Any suggestions? After 13 years of laboring over this, I finally got my form fixed today. Just two issues left:
1) Upon form submission, an email is sent out to the user. How do I redirect them to a Thank-You page so they don't have to stare at the Registration screen while the email is being sent out, as this seems to be a little slow.
2) In the body of these emails is a link to click to go to the Login screen. This works fine. However, I also provide them with two email addresses. How do I make them clickable (like the web link)?
$message = $fname.":\n\n"."Thank you for subscribing to my services.\n\nYour login credentials a \n\nUsername: ".$uname."\nPassword: ".$pwd1."\n\nPlease click the link below to proceed to Login screen:\n\nwww.mySite.com/login.php\n\n\n\nTech Support: techsupport@mysite.com\nSales: sales@mysite.com";Thanks for your help, Landslyde PS: Just kidding abt the 13 years...only took 12 Edited by Landslyde, 25 January 2015 - 05:40 PM. Hi I have a from, now after the users send the form, i want to redirect to a thank you page. my code does not redirect and gives me this error Warning: Cannot modify header information - headers already sent by (output started at D:\inetpub\vhosts\feelmalaysia.com\httpdocs\sendmailsqlar.php:1) in D:\inetpub\vhosts\feelmalaysia.com\httpdocs\sendmailsqlar.php on line 25 I have the redirect page saved in the same directory as the php file. my Php Code : <?php $headers .= 'Content-type: text/plain; charset=UTF-8; format=flowed' . "\r\n"; $headers .= 'Content-Transfer-Encoding: 8bit'."\r\n"; $to = "xxx@xxx.com"; $visitor = $_REQUEST['Name'] ; $visitormail = $_REQUEST['Email'] ; $nationality = $_REQUEST['Nationality'] ; $stulevel = $_REQUEST['Level'] ; $stfield = $_REQUEST['Field'] ; $message = $_REQUEST['Message'] ; $header = "From: $visitormail\n" . "Reply-To: $visitormail\n"; $subject = "Arab Enquiry"; $message = "From: $visitor \n\n Email: $visitormail \n\n Nationality: $nationality \n\n Level: $stulevel \n\n Field: $stfield \n\n Message: $message"; mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header, $headers); //Sending auto respond Email to visitor $reply_header = "From: xxx@xxx.com\n" . "Reply-To: xxx@xxx.com\n"; $reply_subject = "- تم استلام طلبكم"; $reply_to = "$visitormail"; $reply_message = "$visitor \n\n شكرا لزيارتكم موقعنا . \n نود ابلاغكم بأنه تم استلام طلبكم وسوف يتم الرد عليكم قريبا.\n هذه الرسالة مرسلة من نظام الموقع.\n شكرا\n "; mail($reply_to, '=?UTF-8?B?'.base64_encode($reply_subject).'?=', $reply_message, $reply_header, $headers); header('Location: thankyouar.html'); ?> Please help . Thank you I am fairly new to PHP and am having an issue with getting my form to redirect to a thank you page upon sending the form email. I currently have it set to echo a thank you message but it needs to be changed to ensure that we can track all form fills better. I have tried the header method but it doesn't work correctly based on how the website is designed. It seems like there should be an easy way without redesigning too much. Are there any other ways to accomplish this? Please let me know what I need to do in order to get the redirect to work. I have an account on theirsite.com and I want to be able to submit my login credentials from mysite.com/page1.php and then redirect back to mysite.com/page2.php. I've been Googling for hours now and nothing I can find works and I don't know a thing about cURL and would rather not get into it. Not to mention, I'm using free hosting for now and I don't believe I'm able to use cURL anyways. I can get it to log in with the credentials just fine, that's no problem, but I just have no clue how to get it to redirect back to my page or just send the credentials and then staying on my page because I could work with that as well (send credentials to theirsite.com from mysite.com/page1.php and staying on mysite.com/page1.php). Is there anyone that could give me a hand on how to do this without using cURL since my php.ini is not editable? Thanks First, I would like to say hi to everyone, I just registered, so I am new to the forums! But at any rate, I have a question. I have a form that I have programmed in PHP and upon completion of the form, sends the inputed information to my clients e-mail (acts as a lead) and redirects the user to the main part of the website, where you can access all of the content. Now, I need a little assistance on how to make it so if the same user comes back to the site again, they won't always have to fill out the form and it will just forward them to the main page. Clarification: This is what I'm trying to figure out When you go to the url for the first time, the index page has the form on it that must be filled out before you can access the rest of the pages on the website (I have this set as a redirect in the php processing after you submit the form). What coding would I have to add to the html on the form page (index) and/or my php processor and/or the html on the page you are redirected to? My overall goal is for the user to only see the form page once, after they have submitted it the first time, the next time they visit the url, I want them automatically re-directed to the main part of the site since they already completed the form. For Example: (I have this part programmed and working already) The user goes to http://www.example.com for the first time and they see the page with the form on it. They fill it out and click "Submit" and are re-directed to http://www.example.com/page2.html, this redirect is handled with a header "location" command. (This is the part I need help with) At a future time the same user returns to http://www.example.com and since they have already filled out the form they are automatically re-directed to http://www.example.com/page2.html without having to hit the "Submit" button or really even see the form page. Thank you very much in advance, I appreciate your help! Hi
We have a nicely working smtp contact form, however the form redirects to the contact.php file as default I presume, when we want it to go to a thank you page. Can you [please take a look at the code below and clarify where I need to put the thank you page URL;
$redirect_url = "http://".$_SERVER['SERVER_NAME']; //Redirect URL after submit the form $mail->From = $mail->Username; //Default From email same as smtp user $mail->FromName = "Mobile website"; $mail->AddAddress("essexcarrentals@yahoo.co.uk", "Mobile Website"); //Email address where you wish to receive/collect those emails. $mail->WordWrap = 50; // set word wrap to 50 characters $mail->IsHTML(true); // set email format to HTML $mail->Subject = $_POST['Enquiry']; $message = "Name: ".$_POST['name']." \r\n <br>Email Address: ".$_POST['email']." \r\n <br> Phone: ".$_POST['phone']." \r\n <br> Vehicle: ".$_POST['select']." \r\n <br> Dates: ".$_POST['dates']; $mail->Body = $message; if(!$mail->Send()) { echo "Message could not be sent. <p>"; echo "Mailer Error: " . $mail->ErrorInfo; exit; } echo "Message has been sent"; header("Location: $redirect_url"); } ?> I have tried replacing the http:// but this returns a page underfined error on submission? We appreciate your help on this one guys :0) Ash --- Ive tried using header and form action and my page will not load into another page after submitting ! Any ideas?
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Task2 - App</title> <meta name="description" content="The Task2 App"> <meta name="author" content="SitePoint"> </head> <body> <h1>Task 2 - Web App</h1> <br><br> <div class ="submission"> <form action="" method="POST" name='submit'> <label>N:</label> <input type="text" name="number-entered" id="number"/> <input name="form" type="submit" value="Submit"/> <br><br> </form> </div> </body> </html> <?php $number = $_POST['number-entered']; $form_result = $_POST['form']; if(isset($form_result)) { if(($number < 5) || ($number > 25)) { echo 'Input out of range'; } else { $number = $_POST['number-entered']; foreach ( range(1, $number) as $i ) { $triangle_numbers[] = $i * ( $i + 1 ) / 2; } //make a file $contents = fopen('gs://a1-task22020.appspot.com/triangular_' .$number. ".txt", "w"); fwrite($contents,implode(',', $triangle_numbers)); //open the file $contents = fopen('gs://a1-task22020.appspot.com/' . $content, 'w'); //re-open the document if you put something in it fwrite($contents, $number); fclose($contents); } } ?>
I have two pages. one is insert_events.php and the other is veiw_events. In insert_events i have a form which have a submit button. I want when i click on the submit button, it redirects me to the view_events.php page showing the events. Any idea about this problem will be appreciated. Thanks Code: [Select] <form action="checkbox-form.php" method="post"> <input type="checkbox" name="c1" value="1" /> Pending <input type="checkbox" name="c1" value="2" /> Approved <input type="checkbox" name="c1" value="3" /> Rejected <input type="button" name="formSubmit" value="Fetch Results"/> </form> <?php $con = mysql_connect("localhost","root","password"); if (!$con) { die('Could not connect:' . mysql_error()); } mysql_select_db("Products", $con); $result = mysql_query("SELECT * FROM btp_reviews" ); echo "<table border='1' cellspacing='0' cellpadding='0'>"; echo '<tr> <td>Id</td> <td>Review</td> <td>Name</td> <td>Update</td> <td>Status</td> </tr>'; while($row = mysql_fetch_assoc($result)) { echo '<tr>'; echo '<td>' . $row['id'] . '</td>'; echo "<td>" . strip_tags($row['review']) . "</td>"; echo "<td>" . $row['r_name'] . "</td>"; echo "<td>" ."<form action='radio.php' method='post' ><a href=http://localhost/editt.php?id=".$row['id'].">Edit</a>.</td> <td>" ."<input type='radio' name='r1' value='2' />Approve<br/><input type=hidden name=id value='".$row['id']."' /> <input type='radio' name='r1' value='3' /> Reject<br/> <input type=submit value=Submit /></form>"."</td>"; } echo "</table>"; mysql_close($con); ?> Can someone please help? I am simply trying to email process a form with checkboxes and then redirect to a thank you page. It works fine as long as at least one checkbox is checked. It breaks if no checkboxes are checked using the implode function to list the "interests". I'm getting this error (and no redirect to my thank you page): Warning: implode() [function.implode]: Invalid arguments passed... <?php if (isset($_REQUEST['submit'])) { $email = $_REQUEST['email']; $firstName = $_REQUEST['firstName']; $lastName = $_REQUEST['lastName']; $address = $_REQUEST['address']; $city = $_REQUEST['city']; $state = $_REQUEST['state']; $zipcode = $_REQUEST['zipcode']; $homePhone = $_REQUEST['homePhone']; $cellPhone = $_REQUEST['cellPhone']; $interest = $_REQUEST['interest']; $imploded_interest = implode(',',$interest); $comments = $_REQUEST['comments']; $to = 'myemailhere@yahoo.com'; $subject = 'Volunteer Signup'; $message = " <html> <head> <title>Volunteer Signup</title> </head> <body> <p>Hello,<br/>A visitor has submitted the following information from the volunteer page:</p> <p><b>$firstName $lastName</b><br/> $address<br/> $city, $state $zipcode<br/><br/> Home Phone: $homePhone<br/> Cell Phone: $cellPhone<br/> Email: <strong>$email</strong><br/><br/> I would like to help in the following ways:<br/> $imploded_interest </p><br/> <p>$firstName would also like share the following comments:<br/> <q><i>$comments</i></q> </p> </body> </html> "; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Volunteer Signup <myemailhere@yahoo.com>' . "\r\n"; mail($to, $subject, $message, $headers); } ?> <!DOCTYPE html> <html lang="en"> <head> <title>Volunteer</title> </head> <body> <form id="VolunteerForm" method="post" action="thankyou.php"> <table> <tr> <td style="width:150px;">Email Address:</td> <td><input name="email" type="text" id="email" /></td> <td style="width:320px;" class="padtr"><strong>Ways I can help:</strong></td> </tr> <tr> <td>First Name:</td> <td><input name="firstName" type="text" id="firstName" /></td> <td class="padtr"><input name="interest[]" value="yard-sign" type="checkbox"/> Put a yard sign in my yard</td> </tr> <tr> <td>Last Name:</td> <td><input name="lastName" type="text" id="lastName" /></td> <td class="padtr"><input name="interest[]" value="fundraiser-at-home" type="checkbox" /> Host a fundraiser at my home</td> </tr> <tr> <td>Address:</td> <td><input name="address" type="text" id="address" /></td> <td class="padtr"><input name="interest[]" value="phone-calls" type="checkbox" /> Make phone calls to friends and family</td> </tr> <tr> <td>City:</td> <td><input name="city" type="text" id="city" /></td> <td class="padtr"><input name="interest[]" value="mailings" type="checkbox" /> Help with mailings</td> </tr> <tr> <td>State:</td> <td><input name="state" type="text" id="state" /></td> <td class="padtr"><input name="interest[]" value="doors-literature" type="checkbox" /> Help knock on doors and distribute literature</td> </tr> <tr> <td>Zip Code:</td> <td><input name="zipcode" type="text" id="zipcode" /></td> <td class="padtr"><input name="interest[]" value="donate" type="checkbox" /> Make a donation</td> </tr> <tr> <td>Home Phone:</td> <td><input name="homePhone" type="text" id="homephone" /></td> <td class="padtr"><input name="interest[]" value="endorsement" type="checkbox" /> Use my name as an endorsement</td> </tr> <tr> <td>Cell Phone:</td> <td><input name="cellPhone" type="text" id="cellphone" /></td> <td class="padtr"><input name="interest[]" value="newsletter" type="checkbox" /> Sign up for our newsletter</td> </tr> <tr> <td>Comments:</td> <td><textarea name="comments" id="comments" rows="5" cols="17"></textarea></td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> <input type="submit" name="submit" id="submit" value="Submit Now" /> <input type="reset" name="reset" id="reset" value="Clear Form" /></td> </tr> </table> </form> </body> </html> |