PHP - Form Forward Not Working. Help !!!
Hi, I created a form and the trying to forward it to testphp.php. However, it is forwarding but not displaying the score according to the drop down test. If I set any of drop down option to No, then 10 must minus from the total. However, the output is always zero irrespective of the input.
Code: [Select] <html> <head> <title>Billing IE</title> </head> <body > <form id="audit_billing_IE" name="audit_billing_IE" method="post" action="testphp.php"> <table> <tr> <td background-color="green"> Evaluator Name </td> <td> <input type="text" name=evaluator_name id="evaluator_name"/> </td> </tr> <tr> <td> Agent Name </td> <td> <input type="text" name=user_name id="user_name"/> </td> </tr> <tr> <td> Processing Date </td> <td> <input type="text" name="processing_date" id="processing_date"/> </td> </tr> <tr> <td> Review Date </td> <td colspan="3"> <input type="text" name="review_date" id="review_date"/> </td> </tr> <tr> <td> Contact ID </td> <td colspan='3'> <input type="text" name=contact_ID id="contact_ID"/> </td> </tr> <tr> <td> Voice/Non Voice </td> <td colspan='3'> <input type="text" name=audit_type id="audit_type"/> </td> </tr> <tr> <td> A/C #/Case # </td> <td colspan='3'> <input type="text" name=case_no id="case_no"/> </td> </tr> <tr> <td> Product </td> <td colspan='3'> <input type="text" name=product_name1 id="product_name"/> </td> </tr> <tr> <td> Call duration</td> <td colspan='3'> <input type="text" name=product_name2 id="product_name"/> </td> </tr> <tr> <td> Errors </td> <td colspan='3'> <input type="text" name=product_name3 id="product_name"/> </td> </tr> <tr> <td> Parameter A </td> <td colspan='3'> <input type="text" name=product_name4 id="product_name"/> </td> </tr> <tr> <td> Parameter B </td> <td colspan='3'> <input type="text" name=product_name5 id="product_name"/> </td> </tr> <tr> <td> Parameter C </td> <td colspan='3'> <input type="text" name=product_name6 id="product_name"/> </td> </tr> <tr> <td> Parameter D </td> <td colspan='3'> <input type="text" name=product_name7 id="product_name"/> </td> </tr> <tr> <td> Parameter E </td> <td colspan='3'> <input type="text" name=product_name8 id="product_name"/> </td> </tr> <tr> <td> Parameter F </td> <td colspan='3'> <input type="text" name=product_name9 id="product_name"/> </td> </tr> <tr> <td> Parameter G </td> <td colspan='3'> <input type="text" name=product_name10 id="product_name"/> </td> </tr> <tr> <td> Parameter H </td> <td colspan='3'> <input type="text" name=product_name11 id="product_name"/> </td> </tr> <tr> <td> Parameter I </td> <td colspan='3'> <input type="text" name=product_name12 id="product_name"/> </td> </tr> <tr> <td> Parameter J </td> <td colspan='3'> <input type="text" name=product_name13 id="product_name"/> </td> </tr> <tr> <td> Total Possible Points for Audit </td> <td colspan='3'> <input type="text" name=product_name14 id="product_name"/> </td> </tr> <tr> <td> Total Points Obtained for the Audit </td> <td colspan='3'> <input type="text" name=product_name15 id="product_name"/> </td> </tr> <tr> <td> Assessment Score </td> <td colspan='3'> <input type="text" name=product_name16 id="product_name"/> </td> </tr> <tr align="centre"> <th> <span style="color:white" BGcolor="Blue"><b> PARAMETERS </span> </th> <th> <span style="color:white"><b> TOGGLE </span> </th> <th> <span style="color:white"><b> COMMENTS </span></th> <th> <span style="color:white"><b> SCORES </span> </th> </tr> <tr> <td colspan="4" bgcolor="CCCC66" align="left"> <b> A. Credit approval </b> </td> </tr> <tr> <td> Procedure </td> <td> <select name=Para_A_A1 id = "Para_A_A1" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A1_comment id="Para_A_A1_comment"/> </td> <td align="center"> <input type="text" name=Para_A_A1_score id="Para_A_A1_score"/> </td> </tr> <tr> <td> Days Calculation (Service issue case)</td> <td> <select name=Para_A_A2 id = "Para_A_A2" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A2_comment id="Para_A_A2_comment"/> </td> <td> <input type="text" name=Para_A_A2_score id="Para_A_A2_score"/> </td> </tr> <tr> <td> Credit request </td> <td> <select name=Para_A_A3 id = "Para_A_A3" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A3_comment id="Para_A_A3_comment"/> </td> <td> <input type="text" name=Para_A_A3_score id="Para_A_A3_score"/> </td> </tr> <tr> <td> closure </td> <td> <select name=Para_A_A4 id = "Para_A_A4" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A4_comment id="Para_A_A4_comment"/> </td> <td> <input type="text" name=Para_A_A4_score id="Para_A_A4_score"/> </td> </tr> <tr> <td> Comments / interaction </td> <td> <select name=Para_A_A5 id = "Para_A_A5" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A5_comment id="Para_A_A5_comment"/> </td> <td> <input type="text" name=Para_A_A5_score id="Para_A_A5_score"/> </td> </tr> <tr> <td> TEXT updation </td> <td> <select name=Para_A_A6 id = "Para_A_A6" align="center"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </td> <td > <input type="text" name=Para_A_A6_comment id="Para_A_A6_comment"/> </td> <td> <input type="text" name=Para_A_A6_score id="Para_A_A6_score"/> </td> </tr> <tr> <td> <input name="submit" type="submit" id="submit" value="Submit Details" /> <input name="Reset" type="reset" value="Reset"> </td> </tr> </div> </table> </form> </div> </div> </body> </html> Below is the testphp.php Code: [Select] <?php $question1 = $_POST['Para_A_A1']; $question2 = $_POST['Para_A_A2']; $question3 = $_POST['Para_A_A3']; $question4 = $_POST['Para_A_A4']; $question5 = $_POST['Para_A_A5']; $question6 = $_POST['Para_A_A6']; { $numberofansweredquestions = 0; $score = 0; if ($question1 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question1 == "NO") { $numberofansweredquestions++; } if ($question2 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question2 == "NO") { $numberofansweredquestions++; } if ($question3 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question3 == "NO") { $numberofansweredquestions++; } if ($question4 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question4 == "NO") { $numberofansweredquestions++; } if ($question5 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question5 == "NO") { $numberofansweredquestions++; } if ($question6 == "YES") { $numberofansweredquestions++; $score += 10; } else if ($question6 == "NO") { $numberofansweredquestions++; } $maxscore = $numberofansweredquestions * 10; echo "The score is: " . $score . "/" . $maxscore . ""; } ?> Similar TutorialsForm forward is not working in below code. Once I click on submit button, it is not forwarding the results to codetesting.php. <html> <head> </head> <body> <form method="post" action="codetesting.php"> <select name="Para"> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="NA"> NA </option> </select> </form> <input type="submit" name="submit" value="Submit"> </body> </html> So I built a form and if anyone puts // in the text area field named Code: [Select] name="background" it won't work... it fails. This prevents users from entering website URLs, which is an issue since the form is related to website design. I think I have everything else working just fine. Any ideas how I can change this so it will work and allow // ? There may be other things that cannot be entered or maybe a security risk I am missing... here is the code... Code: [Select] <?php // version 2.2 // All placeholders that are used such as {yourEmail@yourDomain.com}, {yourSolve360Token}, {ownership}, // {categoryId}, {templateId} should be replaced with real values without the {} brackets. // REQUIRED Edit with the email address you login to Solve360 with define('USER', 'me@me.com'); // REQUIRED Edit with token, Workspace > My Account > API Reference > API Token define('TOKEN', 'itentionallydeleted'); // Get request data $requestData = array(); parse_str($_SERVER['QUERY_STRING'], $requestData); // Configure service gateway object require 'Solve360Service.php'; $solve360Service = new Solve360Service(USER, TOKEN); // // Preparing the contact data // $contactFields = array( // field name in Solve360 => field name as specified in html form 'firstname' => 'firstname', 'lastname' => 'lastname', 'businessemail' => 'businessemail', 'cellularphone' => 'cellularphone', 'background' => 'background', ); // kill form if spammers use the siteURL field if ( $_GET['url'] != '' || $_GET['firstname'] == 'Your Name' || $_GET['businessemail'] == 'Email Address' ) {header("Location: http://www.openpotion.com/new/error");} else { $contactData = array( // OPTION Apply category tag(s) and set the owner for the contact to a group // You will find a list of IDs for your tags, groups and users in Workspace > My Account > API Reference // To enable this option, uncomment the following: // Specify a different ownership i.e. share the item 'ownership' => 18634876, // Add categories 'categories' => array( 'add' => array('category' => array(18660073)) ), ); // adding not empty fields foreach ($contactFields as $solve360FieldName => $requestFieldName) { if ($requestData[$requestFieldName]) { $contactData[$solve360FieldName] = $requestData[$requestFieldName]; } } // // Saving the contact // // Check if the contact already exists by searching for a matching email address. // If a match is found update the existing contact, otherwise create a new one. // $contacts = $solve360Service->searchContacts(array( 'filtermode' => 'byemail', 'filtervalue' => $contactData['businessemail'], )); if ((integer) $contacts->count > 0) { $contactId = (integer) current($contacts->children())->id; $contactName = (string) current($contacts->children())->name; $contact = $solve360Service->editContact($contactId, $contactData); } else { $contact = $solve360Service->addContact($contactData); $contactName = (string) $contact->item->name; $contactId = (integer) $contact->item->id; } if (isset($contact->errors)) { // Mail yourself if errors occur mail( USER, 'Error while adding contact to Solve360', 'Error: ' . $contact->errors->asXml() ); die ('System error'); } else { // Mail yourself the result mail( USER, 'A new sales lead has been posted to Solve360', 'Contact "' . $contactName . '" https://secure.solve360.com/contact/' . $contactId . ' was posted to Solve360', 'From: noreply@openpotion.com' . PHP_EOL . 'Reply-To: ' . $contactData['businessemail'] . PHP_EOL . 'X-Mailer: PHP/' . phpversion() ); } // // OPTION Adding a activity // /* * You can attach an activity to the contact you just posted * This example creates a Note, to enable this feature just uncomment the following request * */ /* // Preparing data for the note $noteData = array( 'details' => nl2br($requestData['note']) ); $note = $solve360Service->addActivity($contactId, 'note', $noteData); // Mail yourself the result mail( USER, 'Note was added to "' . $contactName . '" contact in Solve360', 'Note with id ' . $note->id . ' was added to the contact with id ' . $contactId ); // End of adding note activity */ // // OPTION Inserting a template of activities // /* * You can also insert a template directly into the contact you just posted * You will find a list of IDs for your templates in Workspace > My Account > API Reference * To enable this feature just uncomment the following request * */ /* // Start of template request $templateId = {templateId}; $template = $solve360Service->addActivity($contactId, 'template', array('templateid' => $templateId)); // Mail yourself the result mail( USER, 'Template was added to "' . $contactName . '" contact in Solve360', 'Template with id ' . $templateId . ' was added to the contact with id ' . $contactId ); // End of template request */ header("Location: http://www.website.com/thank-you"); } ?> Thanks a ton in advance! Jason [attachment deleted by admin] hello, i have a code that downloads a file....i want it to forward the user to a newurl.com when they click download here is my code header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: " . $mm_type); header("Content-Length: " .(string)(filesize($path)) ); header('Content-Disposition: attachment; filename="'.basename($path).'"'); header("Content-Transfer-Encoding: binary\n"); readfile($path); // outputs the content of the file exit(); i want that code to forward to /index.php Hi, My site was recently "hacked" in the sense that Google was made to crawl a rogue page and came to believe it was the original site. This caused a catastrophic decline in Google position and decline in traffic. In researching the issue, it seemed that the solution was to install a forward-confirmed reverse DNS on the site. Yet I've found little information on how to actually implement this. I'm working on a code example I found, but I'm unsure exactly how to apply this even assuming I can get it to work. For those interested in this issue the original site is www.tickerfind.com , the duplicate site is www.handj.net. If you Google "tickerfind.com" you can get the cache, and from this you can see that Google thinks the site is found at handj.net. One of the puzzling things about the sample code (http://smbrown.wordpress.com/2009/04/29/verify-googlebot-forward-reverse-dns/) is that it appears to be determining whether the bot is "good" or "bad", yet I thought the issue was not the bot itself but where it was retrieving the pages to scan. Somehow I thought it would be a "prevention of redirection" type code. So first, I suppose my question is: Am I on the right track. And if so then I can dig into the code. But I'd certainly need to understand why it works. Thanks, Jeff I stepped away from teaching myself php for a few months, and I want to work more on the site I'd started. But I found a glitch and have forgotten enough to not know what to do. I have a form, that is filled out. I want it to enter the info into a mysql database and then forward to a new page, using the ID to submit to a second table. If I set the form action to the new page, it goes to the new page, but never submits any info to the database. If I set the form action to itself, it does put the information into the database. I'm not sure what problem this might indicate. Forgive me for dropping in the entire code, but I'm at a loss and learning how important it is to have notes. (and I seem to have forgotten how to put code into a box? is it div class="codeheader"? <html> <title>submit a new plant form </title> <link rel="stylesheet" type="text/css" href="gaiapedia_styles.css"> <body> <?php if (isset($_POST['submitted'])) { $errors = array(); if (empty($_POST['scientific_name'])) { $errors[] = 'you forgot to enter the scientific name'; } else { $sn = trim($_POST['scientific_name']); } if (empty($_POST['common_name_english'])) { $errors[] = 'you forgot to enter the common name'; } else { $cne = trim($_POST['common_name_english']); } $description4 = trim($_POST['common_names_spanish']); $description5 = trim($_POST['common_names_french']); $description6 = trim($_POST['common_name_chinese']); $description7 = trim($_POST['taxonomic_domain']); $description8 = trim($_POST['taxonomic_subkingdom']); $description9 = trim($_POST['taxonomic_superdivision']); $description10 = trim($_POST['taxonomic_phylum_divis']); $description11 = trim($_POST['taxonomic_class']); $description12 = trim($_POST['taxonomic_order']); $description13 = trim($_POST['taxonomic_suborder']); $description14 = trim($_POST['taxonomic_family']); $description15 = trim($_POST['taxonomic_tribe']); $description16 = trim($_POST['taxonomic_genus']); $description17 = trim($_POST['taxonomic_subgenus']); $description18 = trim($_POST['taxonomic_section']); $description19 = trim($_POST['taxonomic_series']); $description20 = trim($_POST['taxonomic_division']); $description21 = trim($_POST['taxonomic_species']); $description22 = trim($_POST['taxonomic_variety']); $description23 = trim($_POST['taxonomic_form']); $description24 = trim($_POST['itis_serial_number']); $description25 = trim($_POST['paraphyletic_grade']); $description26 = trim($_POST['clade1']); $description27 = trim($_POST['subclade1']); $description28 = trim($_POST['subclade2']); $description29 = trim($_POST['subclade3']); $description30 = trim($_POST['subclade4']); $description31 = trim($_POST['subclade_order']); $description32 = trim($_POST['subclade_family']); $description33 = trim($_POST['earliest_date_known']); if (empty($errors)) { require_once ('sqlconnectfile.php'); $query = "INSERT INTO plantae (scientific_name, common_name_english, common_names_spanish, common_names_french, common_name_chinese, taxonomic_domain, taxonomic_subkingdom, taxonomic_superdivision, taxonomic_phylum_divis, taxonomic_class, taxonomic_subclass, taxonomic_order, taxonomic_suborder, taxonomic_family, taxonomic_tribe, taxonomic_genus,taxonomic_subgenus, taxonomic_section, taxonomic_series, taxonomic_division, taxonomic_species, taxonomic_variety, taxonomic_form, itis_serial_number, paraphyletic_grade, clade1, subclade1, subclade2, subclade3, subclade4, subclade_order, subclade_family, latest_date_known, earliest_date_known) VALUES ('$sn', '$cne', '$description4', '$description5', '$description6', '$description7', '$description8', '$description9', '$description10', '$description11', '$description12', '$description13', '$description14', '$description15', '$description16', '$description17', '$description18', '$description19', '$description20', '$description21', '$description22', '$description23', '$description24', '$description25', '$description26', '$description27', '$description28', '$description29', '$description30', '$description31', '$description32', '$description33', '$description34', '$description35')"; $result = @mysql_query ($query); if ($result) { if(isset($_POST['scientific_name'])) { $plant_id=mysql_insert_id(); } exit(); } else { echo 'system error. No plant added'; echo '<p>' . mysql_error() . '<br><br>query:' . $query . '</p>'; exit(); } mysql_close(); } else { echo 'error. the following error occured <br>'; foreach ($errors as $msg) { echo " - $msg<br>\n"; } } // end of if } // end of main submit conditional ?> <form action="insertaplant1.php" method="post"><fieldset><legend><b>Enter your new plant here</b></legend> blahblah <br><br> Plant name<br> <table bgcolor=#FFEC8B width=590> <tr><td> Scientific Name:<br> <input type="text" name="scientific_name" value="<?php if(isset($_POST['scientific_name'])) echo $_POST['scientific_name']; ?>" /><br> <font color=red>*Required field</font><br> </td> <td>Common Names:<br> <input type="text" name="common_name_english" value="<?php if(isset($_POST['common_name_english'])) echo $_POST['common_name_english']; ?>" /><br><br> </td> <td>Common Name, Spanish:<br> <input type="text" name="common_names_spanish" value="<?php if(isset($_POST['common_names_spanish'])) echo $_POST['common_names_spanish']; ?>" /><br><br> </td><tr> <td>Common Names, French:<br> <input type="text" name="common_names_french" value="<?php if(isset($_POST['common_names_french'])) echo $_POST['common_names_french']; ?>" /><br><br> </td> <td>Common names, Chinese:<br> <input type="text" name="common_name_chinese" value="<?php if(isset($_POST['common_name_chinese'])) echo $_POST['common_name_chinese']; ?>" /><br><br> </td> <td>Taxonomic domain:<br> <input type="text" name="taxonomic_domain" value="<?php if(isset($_POST['taxonomic_domain'])) echo $_POST['taxonomic_domain']; ?>" /><br><br> </td></tr><table> <br> <b>Taxonomy, traditional</b><br> <table bgcolor=#EEDD82 width=590> <tr><td>Kingdom:<br><b>Plantae</b><br> </td> <td>Subkingdom:<br> <SELECT NAME="taxonomic_subkingdom" value="<?php if(isset($_POST['taxonomic_subkingdom'])) echo $_POST['taxonomic_subkingdom']; ?>" > <OPTION VALUE="unknown">unknown <OPTION VALUE="Tracheobionta - vascular plants">Tracheobionta - vascular plants <OPTION VALUE="Embryobionta - embryophytes">Embryobionta - embryophytes </SELECT><br><br> </td> <td>Superdivision:<br> <input type="text" name="taxonomic_superdivision" value="<?php if(isset($_POST['taxonomic_superdivision'])) echo $_POST['taxonomic_superdivision']; ?>" /><br><br> </td></tr> <tr><td>Division/phylum:<br> <input type="text" name="taxonomic_phylum_divis" value="<?php if(isset($_POST['taxonomic_phylum_divis'])) echo $_POST['taxonomic_phylum_divis']; ?>" /><br><br> </td> <td>Class:<br> <input type="text" name="taxonomic_class" value="<?php if(isset($_POST['taxonomic_class'])) echo $_POST['taxonomic_class']; ?>" /><br><br> </td> <td>Subclass:<br> <input type="text" name="taxonomic_subclass" value="<?php if(isset($_POST['taxonomic_subclass'])) echo $_POST['taxonomic_subclass']; ?>" /><br><br> </td></tr> <tr><td>Order:<br> <input type="text" name="taxonomic_order" value="<?php if(isset($_POST['taxonomic_order'])) echo $_POST['taxonomic_order']; ?>" /><br><br> </td> <td>Suborder:<br> <input type="text" name="taxonomic_suborder" value="<?php if(isset($_POST['taxonomic_suborder'])) echo $_POST['taxonomic_suborder']; ?>" /><br><br> </td> <td>Subfamily:<br> <input type="text" name="taxonomic_family" value="<?php if(isset($_POST['taxonomic_family'])) echo $_POST['taxonomic_family']; ?>" /><br><br> </td></tr> <tr><td>Tribe:<br> <input type="text" name="taxonomic_tribe" value="<?php if(isset($_POST['taxonomic_tribe'])) echo $_POST['taxonomic_tribe']; ?>" /><br><br> </td> <td>Genus:<br> <input type="text" name="taxonomic_genus" value="<?php if(isset($_POST['taxonomic_genus'])) echo $_POST['taxonomic_genus']; ?>" /><br><br> </td> <td>Subgenus:<br> <input type="text" name="taxonomic_subgenus" value="<?php if(isset($_POST['taxonomic_subgenus'])) echo $_POST['taxonomic_subgenus']; ?>" /><br><br> </td></tr> <tr><td>Section:<br> <input type="text" name="taxonomic_section" value="<?php if(isset($_POST['taxonomic_section'])) echo $_POST['taxonomic_section']; ?>" /><br><br> </td> <td>Series:<br> <input type="text" name="taxonomic_series" value="<?php if(isset($_POST['taxonomic_series'])) echo $_POST['taxonomic_series']; ?>" /><br><br> </td> <td>Variety:<br> <input type="text" name="taxonomic_variety" value="<?php if(isset($_POST['taxonomic_variety'])) echo $_POST['taxonomic_variety']; ?>" /><br><br> </td></tr> <tr><td>Form:<br> <input type="text" name="taxonomic_form" value="<?php if(isset($_POST['taxonomic_form'])) echo $_POST['taxonomic_form']; ?>" /><br><br> </td> <td>Itis Serial Number:<br> <input type="text" name="itis_serial_number" value="<?php if(isset($_POST['itis_serial_number'])) echo $_POST['itis_serial_number']; ?>" /><br><br> </td> <td>Paraphyletic grade:<br> <input type="text" name="paraphyletic_grade" value="<?php if(isset($_POST['paraphyletic_grade'])) echo $_POST['paraphyletic_grade']; ?>" /><br><br> </td></tr> </table> <br> <b>APG Plant Taxonomy (based on evolutionary tree)</b><br> <table bgcolor=#E3CF57 width=590> <tr><td>Clade1:<br> <input type="text" name="clade1" value="<?php if(isset($_POST['clade1'])) echo $_POST['clade1']; ?>" /><br><br> </td> <td>subclade1:<br> <input type="text" name="subclade1" value="<?php if(isset($_POST['subclade1'])) echo $_POST['subclade1']; ?>" /><br><br> </td> <td>subclade2:<br> <input type="text" name="subclade2" value="<?php if(isset($_POST['subclade2'])) echo $_POST['subclade2']; ?>" /><br><br> </td></tr> <tr><td>subclade3:<br> <input type="text" name="subclade3" value="<?php if(isset($_POST['subclade3'])) echo $_POST['subclade3']; ?>" /><br><br> </td> <td>subclade4:<br> <input type="text" name="subclade4" value="<?php if(isset($_POST['subclade4'])) echo $_POST['subclade4']; ?>" /><br><br> </td> <td>subclade_order:<br> <input type="text" name="subclade_order" value="<?php if(isset($_POST['subclade_order'])) echo $_POST['subclade_order']; ?>" /><br><br> </td> </tr> <tr><td colspan=3>subclade_family:<br> <input type="text" name="subclade_family" value="<?php if(isset($_POST['subclade_family'])) echo $_POST['subclade_family']; ?>" /><br> </td><tr> </table> <br> <b>Plant Timeline</b><br> <table bgcolor=#CDAD00 width=590> <tr><td>earliest_date_known:<br> <input type="text" name="earliest_date_known" value="<?php if(isset($_POST['earliest_date_known'])) echo $_POST['earliest_date_known']; ?>" /><br><br> </td> <td colspan=2>latest_date_known:<br> <input type="text" name="latest_date_known" value="<?php if(isset($_POST['latest_date_known'])) echo $_POST['latest_date_known']; ?>" /><br><br> </td> </tr> </table> </fieldset><br><br> <input type="hidden" name="submitted" value="TRUE"> <input type="hidden" name="submitted_forward" value='$sn'> <input type="submit" /> </form> I use the links in php like this: index.php?content=filename
So I want to use it in future like:
http://example.com/2014/link-name/post-head-name/I dont have the idea how can I do that? Can anybody help me how to do that in PHP? Hello. I have built a web page that is a gallery of pictures populated using an array. Now I would like to create a new web page that shows an enlarged version of a given thumbnail from the gallery. It would be nice once someone loads a photo on the details page if they could simply navigate forward/backwards one photo, instead of having to go back to the gallery to choose the next picture. Had I designed things using a database, then I know how to do this, but alas, this is a simple solution. Is there an easy way to leverage the array that I created - which contains a listing of all file-names from my photo directory - and somehow use HTML/PHP to navigate forward/backward one photo? Here is the array that I build containing all photos from my directory...
<?php $path = "../WORKSPACE/images/"; $files = array(); // Check for Directory. if (is_dir($path)){ // Open Directory-Handle. $handle = opendir($path); if($handle){ // Iterate through Directory items. // Return name of next item in Directory (i.e. File or Folder). while(($file = readdir($handle)) !== FALSE){ if($file != '.' && $file != '..' && preg_match("#^[^\.].*$#", $file)){ // Not Directory, Not Hidden File // Add to array. $files[] = $file; // Simple array. } } closedir($handle); } } var_dump($files); exit(); ?>
Thanks!
I have an array with 192 items in it (0-191) and I want to rearrange them into a multidimensional array with 24 sets of 8. If I wasn't very clear there, here's an abbreviated version of what I want: $arr1 = array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23); $arr2 = array(array(0, 1, 2, 3, 4, 5, 6, 7), array(8, 9, 10, 11, 12, 13, 14, 15), array(16, 17, 18, 19, 20, 21, 22, 23)); Thank you in advance! I have a html form that collect information such as [name], [address], [email] (amongst others) and once you hit the submit button all the data you send to "thank_you.php" which dumps all the data from fields to the predefined database, as wwell as it telly you thank you for registering. What code do I need in order for "thank_you.php" to send [name] and [email] fields automatically in the background to other page on different server (such as www.otherdomain.com/storage.php)? Is such a think possible? This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317019.0 how to arrange a port forward via ssh-tunnel i need to do that on a domain with this syntax https://www2.mydomain.org:2211/ i am on opensuse guess that i firstly have to activate the ssh Hey there, Basically I'm having some difficulty getting this form to work: Code: [Select] <form action=getitem.php method=post name=form2><input type=hidden name=itemid value='1'> <input type=image src=items/ricketyoldsledge.png name=free class=img></form> It'll work if it's at the top of the code for the page I want it on, however I want it to be in a later position (I've included the PHP for the whole page below, so hopefully you can see what I mean). The error I get is that the form appears to send, only instead of sending me to getitem.php it just goes back to sledmakers.php. Code: [Select] <?php include('connect.php'); include('header.php'); include('loggedin.php'); echo 'blah blah"'; // Check profession $result = mysql_query("SELECT * FROM players WHERE id=".$_SESSION['id']) or die(mysql_error()); while($row = mysql_fetch_array( $result )) { $profession = $row['profession']; $level = $row['level'];} // if they're unemployed still if($profession == 'Unemployed'){ echo '<br><br><form action=sledmakers.php?talk=yes method=post name=form1> <input type=submit name=submit value="Talk to the man?"><bR><Br>'; } // if they're a Sledmaker elseif($profession == 'Sledmaker'){ echo 'Sledmaker';} // if they're not a Sledmaker else{ echo 'What? You\'re not a Sledmaker! Go away.';} $talk = $_GET['talk']; // if they're unemployed and pressed to speak with her if($talk == 'yes') { echo 'blahblah'; echo 'You look in the corner and find what you\'re looking for...<bR><br>'; ?> <form action=getitem.php method=post name=form2><input type=hidden name=itemid value='1'><input type=image src=items/ricketyoldsledge.png name=free class=img></form> <br><br><form action=sledmakers.php method=post name=form3> <input type=submit name=submit2 value="Become the Master Sledmakers's Apprentice?"><bR><Br> <?php } else{ echo '';} if(isset($_POST['submit2'])){ echo 'You are now an Apprentice Sledmaker!'; } include('footer.php'); ?> Can anybody help me out? :/ If you need more info, please just ask! I am using this code to build a form: echo '<form method="post" action="mysql.php">'; echo '<table>'; echo '<tr><td>UserID:</td>'; echo '<td><input type="text" name="username"></td></tr>'; echo '<tr><td>Password:</td>'; echo '<td><input type="password" name="password"></td></tr>'; echo '<tr><td colspan="2" align="center">'; echo '<input type="submit" value="Log In"></td></tr>'; echo '</table></form>'; Alone, this form works, but when I add script above it to make it more functional, everything loads properly and I get no errors, but the form will not submit. The submit button is like a dead button. Anyone know why this could be happening? Hello! My name is DJ and I am new to PHP. Basically I designed a website with dreamweaver and on one of the pages I have a contact form. I used an internet tutorial to use php in order to finish the form. But now when someone submits their form, I don't receive an email and they just end up at a blank page. I don't understand why it's not working. Can you help me? Code: [Select] <?php /* Subject and Email Variables */ $emailSubject = 'Sales Inquiry'; $webMaster = 'sales@endorsebro.com'; /* Gathering Data Variables */ $name = $_POST['name']; $business_name = $_POST['business_name']; $phone_number = $_POST['phone_number']; $Email = $_POST['Email']; $website = $_POST['website']; $state = $_POST['state']; $budget = $_POST['budget']; $comments = $_POST['comments']; $body = <<<EOD <br><hr><br> Name: $name <br> Business Name: $business_name <br> Phone Number: $phone_number <br> Email Address: $Email <br> Website: $website <br> State: $state <br> Budget: $budget <br> Comments: $comments <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as html */ $theResults = <<<EOD <html> <head> <title>Endorsebro</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-color: #f1f1f1; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } --> </style> </head> <div> <div align="left">Thank you for your interest! We will be in contact soon!</div> </div> </body> </html> EOD; echo "$theResults"; ?> Thank you for your time. Heres my code for the whole thing.. <?php if($_GET['view'] == 'vote') { $id="{$_GET['id']}"; if ($list_q = mysql_query("SELECT * FROM toplist WHERE id='$id'")) { if (mysql_num_rows($list_q)) { while($list_b=mysql_fetch_array($list_q)) { if ($list_b['ban'] == 0) { if ($list_b['staff'] == 0) { function capitalizeFirstCharacter($value) { $capitalize = preg_replace('/[a-z]/ie', 'strtoupper($0);', $value, 1); return $capitalize; } if(!empty($_POST['Submit'])) { if($_POST['spampre'] == "4iubg") { mysql_query("UPDATE toplist SET vote++ WHERE id = ". $_SESSION['id']) or die (mysql_error()); echo "<tr><td class='trow2'><span class='smalltext'> Thanks for voting. </span></td></tr>"; }else{ echo "<center>Spam Prevention is wrong.</center>"; } } $result = mysql_query("SELECT * FROM toplist WHERE id='$id'") or die(mysql_error()); $row = mysql_fetch_assoc($result); $id = $row["id"]; ?> <div class="navigation"> <!-- start: nav_bit --> <a href="http://runelegend.com/index.php">Runelegend</a> <!-- end: nav_bit --><!-- start: nav_sep_active --> / <!-- end: nav_sep_active --><!-- start: nav_bit_active --> <a href="http://runelegend.com/toplist">Server List</a> / <span class="active">Viewing <?php echo capitalizeFirstCharacter($list_b['servername']);?></span> <!-- end: nav_bit_active --> </div> <!-- end: nav --> <br /> <!-- end: header --> <form action="server.php?view=vote&id<?php ?>" method="post" id="registration_form"> <table border="0" cellspacing="0" cellpadding="5" class="tborder"> <script type="text/javascript" src="http://runelegend.com/jscripts/captcha.js?ver=1400"></script> <tr> <td><span class="smalltext">Please enter the text contained within the image on the right in to the text box below it. This process is used to prevent automated signups.</span></td> <td rowspan="2" align="center"><img src="http://runelegend.com/captcha.php?action=regimage&imagehash=35a910bc839af4d3c4e36faf471c600c" alt="Image Verification" title="Image Verification" id="captcha_img" /><br /><span style="color: red;" class="smalltext">(don't use caps)</span> </td> </tr> <tr> <td><input type="text" class="textbox" name="spampre" value="" id="spampre" style="width: 100%;" /><input type="hidden" name="imagehash" value="35a910bc839af4d3c4e36faf471c600c" id="imagehash" /></td> </tr> </table> <div align="center"> <input type="submit" class="button" name="Submit" value="Submit Registration!" /> </div> </form> <!-- end: member_profile_adminoptions --> </td> </tr> <?php } else { echo '<font color="red" align="center">There is no need to see this server, It isn\'t even a server, it is a staff member.</font><br/>'; } } else { echo '<font color="red" align="center">This server has been banned.<br>If you are the owner of this server, and wish to know why the server is banned from the list, login and go to the <a href="usercp">UserCP</a></font><br/>'; } }}}} ?> I am pretty much trying to make a Vote for system, but the only Problem Im having is the Form code. When I don't have a php code in the (action) part of the code it works, but If I do then it acts as if it's not even there. Edit: Fixed it. I know this is very simple, but... Any way here is the code for my form, but it doesn't post to my database and there are no errors shown. Any ideas? thanks <? include("include/session.php");?> <? include('include/headder_login.php'); ?> <h1>Event Information : <? echo $session->username; ?></h1> <form> <form action="protimes.php" method="post" name="event information"> <input name="id" type="text" value=""> <input name="name" type="number" value="name" size="30"> <select name="event"> <option value="1">50 Front</option> <option value="2">50 Back</option> <option value="3">100 Front</option> </select> <input name="time" type="time" value"time" > <input name="date" type="date" value="date"> <input name="submit" type="button" value="submit" align="right"> <input type="reset" name="reset" value="reset"aligh="right"> </form> protimes.php file $sql="INSERT INTO `cbcrusta_test3`.`info` ( `id` , `name` , `event` , `time` , `date` ) VALUES ('$_POST[id]','$_POST[name]','$_POST[event]','$_POST[time]','$_POST[date')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo "1 record added"; Hi, I am new to php, and I have run into a problem. The tutorial I am using has provided me with this exact code. But it does not work for me. Its very simple. Here is the HTML page: Code: [Select] <body> <FORM ACTION="welcome.php" METHOD=POST> First Name: <INPUT TYPE=TEXT NAME="name"> <INPUT TYPE=SUBMIT VALUE="GO"> </FORM> </body> And here is the php page: <body> <?php echo( "Welcome to our Web site, $name!" ); ?> </body> You can see the problem live at <http://www.freewaycreative.com/test> (dont mind the digits below) The name just does not show. Anyone know why? Thanks! Hi i am trying to send a form to an email address but it works at my house but apparently the person i am doing this for says its not working at their home and at work. So this code works at some place. what would i be doing wrong. Here is the form: Code: [Select] <form method="post" action="envoyez.php"> Nom:<br /> <input name="Nom" type="text"><br> Courriel:<br /> <input name="Courriel" type="text"><br> Commentai <br> <textarea name="Commentaire" rows="15" cols="40"></textarea><br> <input type="submit" value="Envoyez"> </form> and here the code to send the email: Code: [Select] <?php $Nom = $_REQUEST['Nom'] ; $Courriel = $_REQUEST['Courriel'] ; $Commentaire = $_REQUEST['Commentaire'] ; mail( "do@notwork.ca", "Commentaire", $Commentaire, "From: $Courriel" ); ?> what am I doing wrong. Because If i send a comment it is working. Can anyone help pls?? Hey guys, I'm using a PHP form for my website & I can't get it to send the email correctly, all it send me is the first and last name, but none of the other boxes, any help? Also how can I secure it?
This is the PHP file:
<!DOCTYPE html> Hi, php newbie here, web developer newbie too! Some time ago I did a website which included a course registration form which someone else created for me in php. This worked fine and I amended the original to work on another website. I am currently updating this second website and the php has stopped working, and I am no longer in contact with the original developer of the code. The form is at: http://www.bisntechnologies.com/register.htm, and the php is: <?php /* ------- Stuff You Can Change --------- */ $recipient = 'registration@bisntechnologies.com'; $redirect = 'confirmation.php'; /* -------------------------------------- */ $name = $HTTP_POST_VARS['name']; $company = $HTTP_POST_VARS['company']; $position = $HTTP_POST_VARS['position']; $telephone = $HTTP_POST_VARS['telephone']; $email = $HTTP_POST_VARS['email']; $interest = $HTTP_POST_VARS['interest']; $clientip = $_SERVER['REMOTE_ADDR']; $msg = "Name: $name\nCompany: $company\nPosition: $position\nTelephone: $telephone\nE-mail: $email\nInterest: $interest\n\nIP Address: $clientip"; $replymsg = "<html><body style=\"font-family: Trebuchet MS; font-size: 13px\"><p>Dear $name,</p><p>Thank you for registering.</p><p><a href=\"http://www.bisntechnologies.com\"><img border=0 src=\"http://www.bisntechnologies.com/images/NewLogo.jpg\" alt=\"BiSN Technologies Ltd\"></a></p></body></html>"; if (mail($email,'Registration',$replymsg,"MIME-Version: 1.0\r\nContent-type: text/html;charset=iso-8859-1\r\nFrom: registration@bisntechnologies.com")) { mail($recipient,'Registration Confirmation',$msg,"From: $email"); include($redirect); } else { echo "<h4>\"$email\" is an invalid e-mail address. Please click the browser's Back button.</h4>"; } ?> Putting in valid information gives the error: "" is an invalid e-mail address. Please click the browser's Back button." which it didn't used to do. I expect it is a very simple mistake but I cannot trace it. Any help to pinpoint the problem greatly appreciated. |