PHP - Saving Form Input To Folder
hello phpfreaks! first off i have zero knowledge of php. it's just that i need this in my project. what i would want to do is all the values input in the form "tracker.html" when the SUBMIT button is clicked will be saved in my desktop folder named "LOGS". the saved values will be save as an html file name "logs.html" then it can be viewed also by clicking on the PREVIEW button in the tracker. and also if can be done, each will be save separately according to it's CATEGORY.
Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="form1" method="post" action=""> <div> <label for="name3">Name: </label> <input type="text" name="name" id="name3" /> </div> <div> <label for="phone">Phone Number</label> <input type="text" name="phone" id="phone" /> </div> <div> <label for="ticket">Ticket Number</label> <input type="text" name="ticket" id="ticket" /> </div> <div> <label for="issue">Issue:</label> <select name="issue" id="issue"> <option value="no sync">no sync</option> <option value="no route">no route</option> <option value="resched">resched</option> <option value="cancel">cancel</option> </select> </div> <div> <label for="category">Category:</label> <select name="category" id="category"> <option value="level 1">level 1</option> <option value="level 2">level 2</option> <option value="level 3">level 3</option> </select> </div> <div><input type="file" name="upload" id="upload" /> </div> <div> <label for="summary">Summary:</label> <textarea name="summary" id="summary" cols="45" rows="5"></textarea> </div> <div> <input type="submit" name="submit" id="submit" value="Submit" /> <input type="submit" name="preview" id="preview" value="Review" /> <input type="submit" name="clear" id="clear" value="Clear" /> </div> </form> </body> </html> Similar TutorialsI seem to be having a difficult time saving the attachments to a folder on the server, all the examples I see show it to the browser, what I need to do is copy the attachment to a separate folder and do some processing on it. So far everything I get, then ftp to my desktop appears corrupt. It works I just can't seem to unzip the zipped attachments, any ideas? My Code: (Not mine, I used examples from the web and put it into a function) function get_attachments($message_number){ global $connection; $structure = imap_fetchstructure($connection, $message_number); $attachments = array(); if(isset($structure->parts) && count($structure->parts)) { for($i = 0; $i < count($structure->parts); $i++) { $attachments[$i] = array( 'is_attachment' => false, 'filename' => '', 'name' => '', 'attachment' => '' ); if($structure->parts[$i]->ifdparameters) { foreach($structure->parts[$i]->dparameters as $object) { if(strtolower($object->attribute) == 'filename') { $attachments[$i]['is_attachment'] = true; $attachments[$i]['filename'] = $object->value; } } } if($structure->parts[$i]->ifparameters) { foreach($structure->parts[$i]->parameters as $object) { if(strtolower($object->attribute) == 'name') { $attachments[$i]['is_attachment'] = true; $attachments[$i]['name'] = $object->value; } } } if($attachments[$i]['is_attachment']) { $attachments[$i]['attachment'] = imap_fetchbody($connection, $message_number, $i+1); if($structure->parts[$i]->encoding == 3) { // 3 = BASE64 $attachments[$i]['attachment'] = base64_decode($attachments[$i]['attachment']); } elseif($structure->parts[$i]->encoding == 4) { // 4 = QUOTED-PRINTABLE $attachments[$i]['attachment'] = quoted_printable_decode($attachments[$i]['attachment']); } } } } return $attachments; } Calling Code: $a = get_attachments(6); $fp = fopen($a[1]['filename'], 'w'); fwrite($fp, $a); fclose($fp); Hello again everyone, I know someone knows how to do this. Question: In the program you created in question 4, allow your user the option of saving the information for the next time they visit. If they choose "yes", save information in a cookie. 1st part of Question (I have done): Created a text input with options to select font family, font size, and font color. At the bottom of question5.php I added a checkbox to save the information. I then created an if statement on the processing page (question5display.php. I would appreciate some help, thanks guys. Here is the form ( called it question5.php): <html> <head> <title> Please Enter Your Text</title> </head> <body> <form method="post" action="question5display.php"> <p>Enter the text you want formatted please: <input type="text" name="textformat" maxlength="30" size="30" /> <table> <tr> <td><label for="font">Select Font:</label></td> <td><select id="font" name="font"> <option value="Verdana">Verdana</option> <option value="Arial">Arial</option> <option value="Times New Roman">Times New Roman</option> </select> </td> </tr> <tr> <td><label for ="size">Select Size:</label></td> <td><select id="size" name="size"> <option value="10px">10px</option> <option value="12px">12px</option> <option value="14px">14px</option> <option value="20px">20px</option> </select> </td> </tr> <tr> <td><label for="color">Select Color:</label></td> <td><select id="color" name="color"> <option value="green">Green</option> <option value="blue">Blue</option> <option value="red">Red</option> </select> </td> </tr> </table> <input type="checkbox" id="save_prefs" name="save_prefs" /> <label for="save_prefs">Save these preferences for the next time you log in.</label> <input type="submit" name="submit" value="Submit" /> </form> </body> </html> Here is the page it goes to (called it question5display): <?php if (isset($_POST['save_prefs'])) { setcookie('font', $_POST['font'], time() + 60); setcookie('size', $_POST['size'], time() + 60); setcookie('color', $_POST['color'], time() + 60); $_COOKIE['font'] = $_SESSION['font']; $_COOKIE['size'] = $_SESSION['size']; $_COOKIE['color'] = $_SESSION['color']; } session_start(); $_SESSION['textformat'] = $_POST['textformat']; $_SESSION['font'] = $_POST['font']; $_SESSION['size'] = $_POST['size']; $_SESSION['color'] = $_POST['color']; ?> <html> <head> </head> <body> <p <?php echo ' style="font-family: ' . $_SESSION['font'] . '; '; echo 'font-size: ' . $_SESSION['size'] . '; '; echo 'color: ' . $_SESSION['color'] . ';" '; ?>> <?php echo $_SESSION['textformat']; ?> </p> </body> </html> Hello all I have a form for a meeting unable to attend log. An attendee calls in to say they will not be able to make meeting and the form saves the reason etc into a db and infroms (via emails) all staff members who would have attended of the cancelation. It works but for some reason the record saves twice in the db on occasion and I'm unsure why. The loggers fills in some deatils on a form called log.php and then clicks save which goes to the following page: Code: [Select] <?php $auth = $_COOKIE['auth']; $login_id = $_COOKIE['login_id']; header("Cache-Control:no-cache"); if(!$auth == "ok") { header("Location:../log_index.php"); exit(); } include("../php_include/connection.php"); include("../php_include/functions.php"); $absent_date = $_POST['absent_date']; $call_time = $_POST['hour'] .":". $_POST['mins']; $reason = (! get_magic_quotes_gpc ()) ? addslashes ($_POST['reason']) : $_POST['reason']; $reason = fix_quotes($reason); $log_date = date ("d/m/Y"); $log_time = date("G:i"); $attendee_id = str_replace("\'","'",$_POST['attendee_id']); $attendee_name = str_replace("\'","'",$_POST['attendee_name']); $attendee_email = str_replace("\'","'",$_POST['attendee_email']); $sent = $_POST['sent']; if( !$sent ) { echo( "Error - Data not sent from main form.<br><form action=\"log.php\"><input type=\"submit\" name=\"back\" value=\"Back\"></form>" ); } else { $sql = "SELECT staff_username FROM appointments where attendee_id = \"$attendee_id\" and date = \"absent_date\" "; $rs = mssql_query( $sql, $conn ) or die( "Please contact admin and quote: Could not execute Find Staff Query" ); if(mssql_num_rows($rs)!=0) { while ($row = mssql_fetch_array($rs)) { $staff_email = $row["staff_username"]. "@ourdomain.co.uk,"; $to_staff .= $staff_email; } $re_staff = "Unable to attend appointment logged for $attendee_name ($attendee_id)"; $msg_staff = "An unable to attend appointment has been logged for $attendee_name ($attendee_id) \n\nReason: $reason \n\nDate of Absence: $absent_date \n\nTime of Call: $call_time \n\nLog Date: $log_date \n\nLog Time: $log_time \n\nLogger: $login_id \n\nThank You"; $headers_staff = "From: No-Reply@ourdomain.co.uk \r\n"; if( mail( $to_staff, $re_staff, $msg_staff, $headers_staff ) ) { $sql2 = "insert into att_log (attendee_id, reason, absent_date, call_time, log_date, log_time, logger) values (\"$attendee_id\", \"$reason\", \"$absent_date\", \"$call_time\", \"$log_date\", \"$log_time\", \"$login_id\") "; $rs2 = mssql_query( $sql2, $conn ) or die( "Please contact admin and quote: Could not execute Save Absence Log"); $re = "Absence logged for you - $attendee_name ($attendee_id)"; $msg = "An absence has been logged for you - $attendee_name ($attendee_id) \n\nReason: $reason \n\nDate of Absence: $absent_date \n\nTime of Call: $call_time \n\nLog Date: $log_date \n\nLog Time: $log_time \n\nLogger: $login_id \n\nThank You"; $headers = "From: No-Reply@ourdomain.co.uk \r\n"; if( mail( $attendee_email, $re, $msg, $headers ) ) { $sent_to = str_replace(",",",<br>",$to_staff); echo("Thank you, An email has been sent to the attendees meeting organisers<br><br>$sent_to<br>as notification of this absence.<br><br>An email confirming this absence has been sent to the attendees email account.<br><form action=\"log.php\"><input type=\"submit\" name=\"back\" value=\"Back\"></form>"); } else { echo("Error.....Email not sent to attendee.<br>This may be because the attendee did not provide an email account.<br>Please go back and check the record has been saved.<br><form action=\"log.php\"><input type=\"submit\" name=\"back\" value=\"Back\"></form>"); } } else { echo("Error.....Email not sent and record not saved.<br>This may be because the Email server is not responding. Please go back and try again.<br>If the problem persists please contact Admin.<br><form action=\"log.php\"><input type=\"submit\" name=\"back\" value=\"Back\"></form>"); } } else { echo("<br><br>Error.....Email not sent and record not saved.<br><br>This may be because the there is no record of a meeting for this Attendee.<br>Please contact Admin with the Attendee ID: ".attendee_id."<br><br><form action=\"log.php\"><input type=\"submit\" name=\"back\" value=\"Back\"></form>"); } } include("../php_include/close_all.php"); ?> Can anyone shed some light? Or suggest code improvements? Many Thanks This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=342211.0 Hi, how to let php read the url in folder form instead of querystring? e.g. www.example.com/index.php?post=123 www.example.com/post/123/ both is actually directed to the same page - index.php, but how to make it read like a folder when the physical path doesn't really exist? I got this script: But it give me error, file_get_contents cannot open stream. I need to add the FTP connection with user/pass paramaters. then look in set http url, to get the file contents(images) and transfer to ftp server location. Can Anyone take alook and tell me if I am going down the right path and how to get there. Please Code: [Select] function postToHost($host, $port, $path, $postdata = array(), $filedata = array()) { $data = ""; $boundary = "---------------------".substr(md5(rand(0,32000)),0,10); $fp = fsockopen($host, $port); fputs($fp, "POST $path HTTP/1.0\n"); fputs($fp, "Host: $host\n"); fputs($fp, "Content-type: multipart/form-data; boundary=".$boundary."\n"); // Ab dieser Stelle sammeln wir erstmal alle Daten in einem String // Sammeln der POST Daten foreach($postdata as $key => $val){ $data .= "--$boundary\n"; $data .= "Content-Disposition: form-data; name=\"".$key."\"\n\n".$val."\n"; } // Sammeln der FILE Daten if($filedata) { $data .= "--$boundary\n"; $data .= "Content-Disposition: form-data; name=\"".$filedata['name']."\"; filename=\"".$filedata['name']."\"\n"; $data .= "Content-Type: ".$filedata['type']."\n"; $data .= "Content-Transfer-Encoding: binary\n\n"; $data .= $filedata['data']."\n"; $data .= "--$boundary--\n"; } // Senden aller Informationen fputs($fp, "Content-length: ".strlen($data)."\n\n"); fputs($fp, $data); // Auslesen der Antwort while(!feof($fp)) { $res .= fread($fp, 1); } fclose($fp); return $res; } $postdata = array('var1'=>'today', 'var2'=>'yesterday'); $filedata = array( 'type' => 'image/png', 'data' => file_get_contents('http://xxx/tdr-images/images/mapping/dynamic/deals/spot_map') ); echo '<pre>'.postToHost ("localhost", 80, "/test3.php", $postdata, $filedata).'</pre>'; 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 the user fill details and then the email his sent to me the only problem is that the emails keeps going to my spam, can someone help me out please I looked already php website and email format looks the same. This is the link to my form. http://www.people.eurico.co.uk/ here my form script Code: [Select] <?php // Set email variables $email_to = 'xxxxx@xxxxxxx.co.uk'; $email_subject = 'Call back form'; // Set required fields $required_fields = array('fullname','email','telephone','comment'); // set error messages $error_messages = array( 'fullname' => 'Please enter a Name to proceed.', 'email' => 'Please enter a valid Email.', 'telephone' => 'Please telephone.', 'comment' => 'Please enter your Message to continue.' ); // Set form status $form_complete = FALSE; // configure validation array $validation = array(); // check form submittal if(!empty($_POST)) { // Sanitise POST array foreach($_POST as $key => $value) $_POST[$key] = remove_email_injection(trim($value)); // Loop into required fields and make sure they match our needs foreach($required_fields as $field) { // the field has been submitted? if(!array_key_exists($field, $_POST)) array_push($validation, $field); // check there is information in the field? if($_POST[$field] == '') array_push($validation, $field); // validate the email address supplied if($field == 'email') if(!validate_email_address($_POST[$field])) array_push($validation, $field); } // basic validation result if(count($validation) == 0) { // Prepare our content string $email_content = 'peoplesmartlearning.co.uk: ' . "\n\n"; // simple email content foreach($_POST as $key => $value) { if($key != 'submit') $email_content .= $key . ': ' . $value . "\n"; } // if validation passed ok then send the email mail($email_to, $email_subject, $email_content); // Update form switch $form_complete = TRUE; } } function validate_email_address($email = FALSE) { return (preg_match('/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i', $email))? TRUE : FALSE; } function remove_email_injection($field = FALSE) { return (str_ireplace(array("\r", "\n", "%0a", "%0d", "Content-Type:", "bcc:","to:","cc:"), '', $field)); } ?> The HTML Code: [Select] <div class="call_us_form"> <p class="title">WE'LL CALL YOU BACK</p> <?php if($form_complete === FALSE): ?> <form class="contact_form" id="fm-form" method="post" action="index.php" > <fieldset> <div class="fm-req"> <label for="fm-firstname">Name</label> <input type="text" id="fullname" class="detail" name="fullname" value="<?php echo isset($_POST['fullname'])? $_POST['fullname'] : ''; ?>" /> <?php if(in_array('fullname', $validation)): ?><script type="text/javascript">alert("Please enter a Name"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-firstname">Email</label> <input type="text" id="email" class="detail" name="email" value=" <?php echo isset($_POST['email'])? $_POST['email'] : ''; ?>" /> <?php if(in_array('email', $validation)): ?><script type="text/javascript">alert("Please enter a valid Email Address"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-firstname">Number</label> <input type="text" id="telephone" class="detail" name="telephone" value="<?php echo isset($_POST['telephone'])? $_POST['telephone'] : ''; ?>" /> <?php if(in_array('telephone', $validation)): ?><script type="text/javascript">alert("Please enter telephone number"); history.back();</script><?php endif; ?> </div> <div class="fm-req"> <label for="fm-lastname">Message</label> <textarea cols="40" rows="5" id="comment" name="comment" class="mess"><?php echo isset($_POST['comment'])? $_POST['comment'] : ''; ?></textarea> <?php if(in_array('comment', $validation)): ?><script type="text/javascript">alert("Please enter your message"); history.back();</script><?php endif; ?> </div> <input class="submit_button" type="submit" value="Call us" /> </fieldset> </form> <?php else: ?> <p>Thank you for your Message!</p> <p>We will get back to you as soon as we can</p> <script type="text/javascript"> setTimeout ('ourRedirect()', 5000) function ourRedirect () { location.href='index.php' } </script> <?php endif; ?> Hi, everyone. I need help with a PHP project on which I'm currently working. I need to create a form which does the following: 1) When you insert a negative number, it echoes: "Please insert a positive number." 2) When you insert a number greater than 1000, it echoes: "Please insert a number less than 1000." 3) When you insert anything else that's not a number (ie: a letter), it echoes: "Please insert a valid number." 4) If it doesn't do any of the above, it'll take the number that you entered and loop "Hello World" as many times as that number. The code that I have so far looks something like below. (I had to type it from the top of my head.) <?php <form action="hwpositive.php" method="post"> Enter number: <input type="text" name="number" /> </form> $input = $_POST["number"]; if ($input<0) { echo "Please insert a positive number."; } else if ($input>1000) { echo "Please insert a number less than 1000."; } else if ($input!=is_numeric) { echo "Please insert a valid number."; } else { for {$i; $i<=$_POST["number"]; $i++;} } ?> I can get this code to do the first three tasks listed above, but not the last. I'm a high school Programming 12 student, and this is my first year of learning PHP coding. Please help me out. Would it be better to use the case-switch option? I'm not too familiar on how to use it. Thank you in advance! I appreciate your help greatly. Hello friends i need to make the following idea Code: [Select] <form method="post"> Enter ID : <input type="text" name="id" /> <input type="submit" value="Submit" /> </form> and the input id should goes to php code on same page as $id $ORGtext= file_get_contents('NewsID=$id'); how to write it correct thanks Whit my code it only appear a list of 1 or 0 and the id but I don't know how to get to show only the id Like so: submit 0 60/ 0 59/ 0 58/ 0 57/ 0 56/ 0 45/ 0 38/ 1 37/ on my first page: Code: [Select] <table border="2"> <tr> <th>Id</th> <th>User</th> <th>Comment</th> <th>Yes</th> <th>No</th> </tr> <form method="post" action="admincommentdelete.php" id="formc"> <?php $vv = array(); $st = Comment::test($result['article']->id,0,999); $vv['comment'] = $st['comment']; $i = 0; foreach($vv['comment'] as $p) { $i++; echo "<tr>"; echo "<td>".$p->id."</td>"; echo "<td>".$p->usern."</td>"; echo "<td>".$p->com."</td>"; echo "<td><input name=$i type=radio value='1'/></td>"; echo "<td><input name=$i type=radio value='0'/></td>"; echo "<input type=hidden name=h".$i." value=$p->id/>"; echo "</tr>"; } ?> <input type="submit" value="submit" name="submit"> </form> </table> second: Code: [Select] <?php $id = array(); if(isset($_POST['submit'])) { $data = array(); $data = $_POST; foreach($data as $key) { echo $key."</br>"; } } ?> I have a number of Forms which I want to control the input, for example prevent people from using numbers or ensure that people use specific characters. For example "Your password must contain a capital letter and at least one number". Does anyone know what code I should use to do this. I have a form:
<input id="house" name="element_1" class="element radio" type="radio" value="Daniel" />
<input id="car" name="element_2" class="element radio" type="radio" value="Joe" />
How can I give to "element_1" multiple value instead of only one?
Welcome <?php echo $_GET["element_1"]; ?><br> ==== Welcome Daniel
element_1 = element_12 = element_13
WHERE
element_1 = Daniel
element_12 = car
element_13 = key
Welcome <?php echo $_GET["element_12"]; ?><br> ==== Welcome car
I need to create a structure for a 10 different values. I heard that will be easy to use array or object, I don t really now how to structure it.
I want to redirect my visitors to a certain page after validating their form input to be correct. I have 3 codes which are named code1, code2 and code 3. these are just 6 digit numbers. After a user has filled out the correct 3 codes I want to forward them to specific page but as of now I get no errors but the page that opens up is my handle_form.php which is the file that is only supposed to be validating the inputs. Here's is the code to the form: <form action="handle_form.php" method="post"> <div class="class6"> <b> <table border="1" width="500" height="60" bgcolor="#898989" bordercolor="black"> <tr> <td align="center" width="150"> <a href="/step1.php" target="_blank">Link 1</a> </td> <td align="center" width="150"> Code 1 </td> <td width="200" align="center"> <input type="text" name="code1" size="6"/> </td> </tr> <tr> <td align="center" width="150"> <a href="/step2.php" target="_blank">Link 2</a> </td> <td align="center" width="150"> Code 2 </td> <td width="200" align="center"> <input type="text" name="code2" size="6"/> </td> </tr> <tr> <td align="center" width="150"> <a href="/step3.php" target="_blank">Link 3</a> </td> <td align="center" width="150"> Code 3 </td> <td width="200" align="center"> <input type="text" name="code3" size="6"/> </td> </tr> </table></b><br> <input type="submit" name="submit" value="Take me to the Download Page"/> </div> </form> Now here is the code within the handle_form.php <?php if (isset($_POST['submitted'])) { $realcode1 = 723598; $realcode2 = 193598; $realcode3 = 887362; if (!empty($_POST['code1'])) { $code1 = escape_data (htmlspecialcharacters($_POST['code1'])); } else { echo '<p><font color="red"> You forgot to enter code1.</font></p>'; $code1 = FALSE; } if (!empty($_POST['code2'])) { $code2 = escape_data (htmlspecialcharacters($_POST['code2'])); } else { echo '<p><font color="red"> You forgot to enter code2.</font></p>'; $code2 = FALSE; } if (!empty($_POST['code3'])) { $code3 = escape_data (htmlspecialcharacters($_POST['code3'])); } else { echo '<p><font color="red"> You forgot to enter code1.</font></p>'; $code3 = FALSE; } if ($code1 = $realcode1 && $code2 = $realcode2 && $code3 = $realcode3) { $url .= '/software/Express_Paste.zip'; header('Location: $url'); } else { echo "You haven't entered the correct codes."; } } exit(); ?> When i submit the form using the correct data my handle_form.php page opens??? Where am I going wrong? Hello Codingforums, yet again I desire some help to my coding, this time regarding a paypal button. Hey Everyone, My website asks for an email address when one registers but I want to put a limit it on it (like to register you gotta have an email address from a specific domain). How can I edit the form input to do this? Any help will be greatly appreciated, thanks -STG Hello again. I need help for a PHP project I'm working on for school. I need it to do the following: 1) When nothing is entered, it will echo "Please enter a number." 2) When "0" is entered, it will echo "Please enter a number that is not zero." My code is as follows... <form action="hwpositive.php" method="post"> Enter number <input type="text" name="number"/><br /> </form> <?php $input = $_POST['number']; // if number entered is less than 0 if ($input<0) { echo "Enter a positive number."; } // if number entered is greated than 1000 elseif ($input>1000) { echo "Enter a number less than 1000."; } // if number entered is not a number (ie, a letter, a character) elseif (!is_numeric($input)) { echo "<br><img src=\"squidward.jpg\"><br><br>Enter a valid number. "; } // if number entered is between 1-999 elseif (($input>0) && ($input<1000)) { echo "hello world " . $i . "<br />"; } // if number entered is zero elseif ($input===0) { echo "Please enter a number that is not zero."; } // if no number is entered elseif ($input=null) { echo "Please enter a number."; } else { echo "Please enter a number."; } ?> However, it's not working. What am I doing wrong? Everytime I enter this page, it should show me "Please enter a number" because I haven't entered anything yet, but it doesn't. It's showing me the image right away. I don't understand... Help me, please! Thank you so much in advance. I appreciate the help. 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 |