Jump to content

Search the Community

Showing results for tags 'form'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hi, I'm after a song search request script to be made for my website below is some info and bullet points of what I would like the script to have. > Search box and the php script will read a .csv file and show matching data > Search results to show up in table column 1 radio button, column 2 Artists, column 3 tracks, > Above results search box below search results a contact form that will email song request and Name (mandatory), email (mandatory) Dedicate (optional) comment (optional) to my own email address > Alphabetical listing (ie clicking A will show all artists beginning with A) Above search box I do have some other ideas - email me and I'll give you my Skype ID so we can talk more
  2. Title says it all. Here is the error I get: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '','1-11-111-11-11-11111','',now())' at line 1 Upload script looks like this: if($_POST['doSubmit'] == 'Add Distributor') { if (!$link) { die('Could not connect: ' . mysql_error()); } $name_dist=mysql_real_escape_string($_POST['name_dist']); $address_dist=mysql_real_escape_string($_POST['address_dist']); $city_dist=mysql_real_escape_string($_POST['city_dist']); $state_dist=mysql_real_escape_string($_POST['state_dist']); $zip_dist=mysql_real_escape_string($_POST['zip_dist']); $phone_dist=mysql_real_escape_string($_POST['phone_dist']); $ffl_dist=mysql_real_escape_string($_POST['ffl_dist']); $dob_dist=mysql_real_escape_string($_POST['dob_dist']); $sql="INSERT INTO `distributors` (name_dist,address_dist,city_dist,state_dist,zip_dist,phone_dist,ffl_dist,dob_dist,dateAdded_dist) VALUES ('$name_dist','$address_dist','$city_dist','$state_dist','$zip_dist',$phone_dist','$ffl_dist','$dob_dist',now())"; if (!mysql_query($sql,$link)) { die('Error: ' . mysql_error()); } echo "<div class=\"msg\">New Distributor Added....done.</div>"; } Form looks like this: <p><?php if(!empty($msg)) { echo $msg[0]; } ?></p> <table width="100%" border="0" cellpadding="5" cellspacing="2" class="myaccount"> <tr> <td style="text-align:right"><form name="addNew" id="addNew" method="post" action="distributors.php">Name of Distributor or Consignor: </td> <td style="text-align:left"><input name="name_dist" type="text" id="name_dist" size="40" class="required"></td> </tr> <tr> <td style="text-align:right">Street: </td> <td style="text-align:left"><input name="address_dist" type="text" size="40" class="required" id="address_dist"></td> </tr> <tr> <td style="text-align:right">City: </td> <td style="text-align:left"><input name="city_dist" type="text" size="40" class="required" id="city_dist"></td> </tr> <tr> <td style="text-align:right">State: </td> <td style="text-align:left"><input name="state_dist" type="text" size="40" class="required" id="state_dist"></td> </tr> <tr> <td style="text-align:right">Zip: </td> <td style="text-align:left"><input name="zip_dist" type="text" size="40" class="required" id="zip_dist"></td> </tr> <tr> <td style="text-align:right">Phone Number: </td> <td style="text-align:left"><input name="phone_dist" type="text" id="phone_dist" size="40" class="required"></td> </tr> <tr> <td style="text-align:right">FFL: </td> <td style="text-align:left"><input name="ffl_dist" type="text" id="ffl_dist" size="40"></td> </tr> <tr> <td style="text-align:right">DOB if no FFL: </td> <td style="text-align:left"><input name="dob_dist" type="text" id="dob_dist" size="40"></td> </tr> <tr> <td colspan="2" style="text-align:center"><input name="doSubmit" type="submit" id="doSubmit" value="Add Distributor"></form></td> </tr> </table> DB table looks like this: `id_dist` int(11) NOT NULL AUTO_INCREMENT, `name_dist` varchar(255) COLLATE latin1_general_ci NOT NULL, `address_dist` text COLLATE latin1_general_ci NOT NULL, `city_dist` varchar(100) COLLATE latin1_general_ci NOT NULL, `state_dist` varchar(2) COLLATE latin1_general_ci NOT NULL, `zip_dist` int(5) NOT NULL, `phone_dist` varchar(255) COLLATE latin1_general_ci NOT NULL, `ffl_dist` varchar(255) COLLATE latin1_general_ci NOT NULL, `dob_dist` varchar(10) COLLATE latin1_general_ci NOT NULL, `dateAdded_dist` date NOT NULL DEFAULT '0000-00-00', PRIMARY KEY (`id_dist`), UNIQUE KEY `name_dist` (`name_dist`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=9 ; Any ideas on why I am getting that error? I have other forms that use this same setup and they work fine so I am not sure what I am missing or have done wrong. Any help would be appreciated. Thanks, Clint
  3. Is it possible to insert form data to a Mysql database and print to email a printable document and not just the standard email listing the fields of a web form? ie " looks like the actual document we ultimately want to print?"
  4. Good afternoon! I will apologize upfront, because I am a complete novice when it comes to PHP. I know enough to really mess things up. So, I have inherited a PHP form that writes to MySQL table, then submits to Marketo and gets passed along to Salesforce. The programmer who wrote it, is no longer available and I need to change some of the code. In a nutshell, I have a hidden field (Primary Interest) that populates it's value based on a variable ($serviceLine) that gets entered when a new record is inserted into the table. I need to create a dropdown select that writes to a variable ($interest) for my form, then use that variable to populate Primary Interest, or default to $serviceLine if $interest is not present or NULL. Thanks in advance.
  5. I'm adding a piece of functionality to an existing SAML login plugin for the "owncloud" cloud storage application https://github.com/owncloud/apps/tree/master/user_saml Within the lib/ directory of this plugin there is a hook class (hooks.php) which extracts SAML attributes and creates a user account based on this info. It currently expects email and name to be available to populate the user account details, which are not available in most identity providers. I'd like to provide a form that when a new user logs in, they can submit the personal information rather than have blank info be given by SAML. At line 83 in this hooks.php file (available at the link above), i'd like to call a page or function that would present a form to the user (with three fields - firstname, surname and email), then on submit, return to the hook class making the three variables available to the rest of the hooks class code. Since this hooks file is a 'processing' PHP file rather than a page that is rendering anything, and also part of the owncloud framework's workings, I don't think this can be done with just PHP and probably a combination of javascript/ajax might be needed. Doesn anyone have an opinion on a solution to this, i.e. being able to move out of a hook class to provide a user interactive form, then continue from the place where the hook class was - utilising the fields the user provided?
  6. Hello I was wondering how could i autofill a form based on a drop down list using raw php and mysql . I know that the connection to database would have to be established but what next ? Any Pointers would be helpful Also check the attached photo to maybe understand more than I'm explaining
  7. I have in promotie.php the next form: <form accept-charset="UTF-8" action="redirect.php"> <input name="code" type="text" id="code" maxlength="15" /> <input type="submit" value="Submit"/> </form> In redirect.php I have this code: <?php header('Location: download.php?code='.$_POST['code']); ?>What I want to do is the next thing: I will create a file code.txt, where I write on each line my promotional codes. Now how can I redirect to promotieerror.php or show a error if the code that was writed by the user doesn't exist in code.txt ? P.S.: I don't want to use MySQL/Databases. Thanks in advance for help.
  8. I want a website to have a form that DOES NOT use captha but I get alot of spam. I want to use a couple of methods that will not deter the user. My methods are honeypot technique(hidden form) and not submitting form if contain certain words. I want to use is a hidden field that if a spam bot fills out it will disregard the form the spam bot will think the form was submited but it will actually disappear into the abyss . if the form contains www. or .com or http:// or armani,Pharmacy,Viagra... you get the idea . it will not submit the form but will still take you to the thank you page
  9. I'm using a classified ads script that I want to modify. Although I have zero experience using PHP I've managed to link the classified script with my MYsql database, in addition to modifying the look of the site to the way I want. I'll explain the modification that I want: When you post an ad on my site I want the information to be listed vertically in the form of a box with the main information present within the box, not horizontally like a craiglist ad, which is how it looks right now. I want the next ad thats posted (also in a box) to be placed alongside, to the left of the previous ad, pushing it to the right. Its like choosing between list view or gallery view on ebay. I want the ads to be only viewed in a gallery mode. I want 5 columns/spaces for 5 boxes accross, and 10 rows down before the ad gets pushed to the next page. I hope this makes sense. How hard will it be to create a script that can do this? Do I need to know more than just PHP?
  10. Hello, I am fairly novice at PHP. I have a couple of reference books*, but they seem to be vague on the subject of "arrays", that is why I am asking for help today. I am trying to create a simple array using a form and radio button selectors. At the bottom I will explain what I am trying to accomplish. Here is the sample of my code using one question: HTML........................................................................................................................................................................................ <fieldset> <legend>DO YOU EXERCISE DAILY?</legend> <form action="" method="post" /> <label for="question" class="question">I often exercise on a daily basis for at least 20 minutes a day</label> <label for "Never" class="radio"> <input type="radio" name="answer[0]=1" value="Never" /> Never</label> <label for="Seldom" class="radio"> <input type="radio" name="answer[1]=2" value="Seldom" /> Seldom</label> <label for="Occasionally" class="radio"> <input type="radio" name="answer[2]=3" value="Occasionally" /> Occasionally</label> <label for="Often" class="radio"> <input type="radio" name="answer[3]=4" value="Often" /> Often</label> <label for="Always" class="radio"> <input type="radio" name="answer[4]=5" value="Always" /> Always</label> </form> </fieldset> When a question is asked, the user can choose only one (radio button) answer. That answer is assigned a number (1 thru 5) and will be displayed and then eventually tallied along with answers to other questions (not shown) for a grand total or sum. PHP.......................................................................................................................................................................................... <?php //Error Displaying ini_set ('display_errors',1); error_reporting (E_ALL & ~E_NOTICE); //Print each answer <?php if (isset($_POST["answer"]) && is_array($_POST["answer"]) && count($_POST["answer"]) > 0) { foreach ($_POST["answer"] as $answer) { echo htmlspecialchars($answer, ENT_QUOTES); echo '<br />'; } } ?> // Print each key and value. <?php $answer = array ('Never', 'Seldom', 'Occasionally', 'Often', 'Always'); foreach ($answer as $ans => $answer) { print "$ans: $answer<br />\n"; } ?> I am able to get the answer (picked via radio button) to print or echo on the page, but I am not sure how to display a number represting each choice (1 for Never ~ 5 for Always). Not sure what I am doing wrong. I have researched other examples on the web and tried their logic, still no success. I guess I am just not getting it. Any advice or help would be appreciated. Also do any of you readers recommend another book to learn from? Signed, Garfan *Murachs PHP and MYSQL *PHP For The World Wide Web by Larry Ullman
  11. I'm about to update my search script. The search engine searches in my database where I ask it to search. What is new is I want do some search words, that the users can check in a checkbox, if he wants to use the word in the search. As for now my search engine works, the only problem is that it only searches the last word and not all of the checked words. My formula looks like this: <form method="POST" action="<?=$_SERVER["PHP_SELF"]?>"> <p>Search for: </p> Books: <input type="checkbox" name='search' value="books"> Movies: <input type="checkbox" name='search' value="movies"> Outdoor: <input type="checkbox" name='search' value="outdoor"> Indore: <input type="checkbox" name='search' value="indore"> </p> <p><input type='submit' value='Search'></p> </form> The php code looks like: <?php if(isset($_POST['search'])) { $connx = mysql_connect('localhost', '*******', ',*********') or die("connx"); $db = mysql_select_db('*********') or die(mysql_error()); # convert to upper case, trim it, and replace spaces with "|": $search = mysql_real_escape_string($search); $search = strtoupper(preg_replace('/\s+/', '|', ($_POST['search']))); # create a MySQL REGEXP for the search: $regexp = "REGEXP '[[:<:]]($search)[[:>:]]'"; $query = "SELECT * FROM `keywords` WHERE UPPER(`keywords01`) $regexp OR ". "`keywords02` $regexp OR ". "`keywords03` $regexp OR ". "`keywords04` $regexp"; $result = mysql_query($query) or die($query . " - " . mysql_error()); echo "<table>\n"; while($row = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td><img src=../{$row['type']}/{$row['folder']}/{$row['date']}-{$row['num']}/{$row['thumbimage']} border=1></td>"; echo "<td>{$row['name']}</td>"; echo "<td>{$row['date']}</td>"; echo "<td><a href=../view.php?id={$row['id']} target=blank>VIEW</a></td>"; echo "</tr>\n"; } } else { echo "<p>Sorry, no results matched your search.</p>"; } ?> Are there someone, who can figure out, why it is only the last marked checkboxs word that are searched and not all marked words and how do I get it to search for all marked words? Hope someone can help.
  12. I need help with this. I have a form for add new users. But I don't want users to change the Title - I want to auto fill the username they have already. Right now it look like the picture. But I want to echo getUsername(); Any one can help me with this? Please! Here is my form code now. Any one? Please! ), 'title' => array( 'type' => 'text', 'name' => 'title', 'caption' => _t('_modzzz_model_form_caption_title'), 'value' => $sDefaultTitle, 'required' => true, 'checker' => array ( 'func' => 'length', 'params' => array(3,$this->_oMain->_oConfig->getTitleLength()), 'error' => _t ('_modzzz_model_form_err_title'), ), 'db' => array ( 'pass' => 'Xss', ), 'display' => true, ),
  13. Hello, I am looking for someone that can redesign my old form and make some validation changes... Things I need the form to do: Confirm leaving the page, if it is done other than by submitting the form There is a place for three different phone numbers, home, work, and mobile, I only need to ensure that at least one of those is filled out, more can be, but one is required Proper character input type validation, phone numbers, zip code, email address Required fields, some of which are of the HTML "select" type of input Format masking, e.g. phone numbers Needs to be multi-browser compatible, Firefox, Chrome, IE, Safari The form needs to be smooth and curvy, very jQuery / AJAX Convert the MySQL to MySQLi The form should have it's own css, so that it can stand alone on it's own, but not conflict with other css either, e.g. start all of it's css with something like "form_" or something Improve upon the PHP as you see fit If you can make or add a better way to put in a date of birth, other than 3 drop-down boxes, then that would be good as well In the form there is also a question of whether or not an address is the same as another address, if so, it copies the address info, if not, it shows a new div, for a new address, the form will still need that functionality as well P.S. The form is called via an SSL secure page Please contact me with your quotes and any forms that you would like to show off, at motorsportfun2013 [@] gmail dot com Since I apparently can't attach the page, I'll post the code of what I'm currently using... <? require 'includes/auth.php'; $AgentID = $_SESSION['AgentID']; $AgentName = $_SESSION['AgentName']; if (isset($_GET['orderticketid'])) { $orderticketid = clean($_GET['orderticketid']); $result = mysql_query(" SELECT OrderTickets.*, Agencies.AgencyName, InsuranceCarriers.InsuranceCarrier FROM OrderTickets LEFT JOIN Agencies ON OrderTickets.AgencyID = Agencies.AgencyID LEFT JOIN InsuranceCarriers ON OrderTickets.InsuranceCarrierID = InsuranceCarriers.InsuranceCarrierID WHERE OrderTickets.OrderTicketID = '$orderticketid' AND OrderTickets.AgentID = '$AgentID' "); while ($OrderTicketRow = mysql_fetch_assoc($result)) { $InsuranceCarrierID = $OrderTicketRow['InsuranceCarrierID']; $InsuranceCarrierPolicyNumber = $OrderTicketRow['InsuranceCarrierPolicyNumber']; $OrderTicketFirstName = $OrderTicketRow['OrderTicketFirstName']; $OrderTicketMiddleName = $OrderTicketRow['OrderTicketMiddleName']; $OrderTicketLastName = $OrderTicketRow['OrderTicketLastName']; $OrderTicketAddress = $OrderTicketRow['OrderTicketAddress']; $OrderTicketCity = $OrderTicketRow['OrderTicketCity']; $OrderTicketState = $OrderTicketRow['OrderTicketState']; $OrderTicketZipCode = $OrderTicketRow['OrderTicketZipCode']; $OrderTicketExamLocation = $OrderTicketRow['OrderTicketExamLocation']; $OrderTicketExamLocationAddress = $OrderTicketRow['OrderTicketExamLocationAddress']; $OrderTicketExamLocationCity = $OrderTicketRow['OrderTicketExamLocationCity']; $OrderTicketExamLocationState = $OrderTicketRow['OrderTicketExamLocationState']; $OrderTicketExamLocationZipCode = $OrderTicketRow['OrderTicketExamLocationZipCode']; $OrderTicketHomePhone = $OrderTicketRow['OrderTicketHomePhone']; $OrderTicketWorkPhone = $OrderTicketRow['OrderTicketWorkPhone']; $OrderTicketMobilePhone = $OrderTicketRow['OrderTicketMobilePhone']; $OrderTicketEmailAddress = $OrderTicketRow['OrderTicketEmailAddress']; $OrderTicketDOBMonth = date('m', strtotime($OrderTicketRow['OrderTicketDOB'])); $OrderTicketDOBDay = date('d', strtotime($OrderTicketRow['OrderTicketDOB'])); $OrderTicketDOBYear = date('Y', strtotime($OrderTicketRow['OrderTicketDOB'])); $OrderTicketGender = $OrderTicketRow['OrderTicketGender']; $OrderTicketSmoker = $OrderTicketRow['OrderTicketSmoker']; $OrderTicketPolicyType = $OrderTicketRow['OrderTicketPolicyType']; $OrderTicketPolicyAmount = $OrderTicketRow['OrderTicketPolicyAmount']; $OrderTicketSpecialInstructions = $OrderTicketRow['OrderTicketSpecialInstructions']; } } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="images/favicon.ico" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" src="includes/JavaScriptValidationFunctions.js"></script> <script type="text/javascript" src="includes/Modernizr-2.5.3.forms.js"></script> <script type="text/javascript" data-webforms2-support="validation" src="includes/html5Forms.js"></script> <script src="includes/jquery.maskedinput-1.3.min.js" type="text/javascript"></script> <script type="text/javascript"> jQuery(document).ready(function() { jQuery("#OrderTicketHomePhone").mask("(999) 999-9999"); jQuery("#OrderTicketWorkPhone").mask("(999) 999-9999"); jQuery("#OrderTicketMobilePhone").mask("(999) 999-9999"); }); </script> <script type="text/javascript"> window.onbeforeunload = function() { return 'You have unsaved changes!'; } </script> <script type="text/javascript"> function ShowHide(){ if (document.getElementById("OrderTicketExamLocation").value == '') { $('.show_hide').hide(); } if (document.getElementById("OrderTicketExamLocation").value != 'Home') { $('.show_hide').show(); } else if (document.getElementById("OrderTicketExamLocation").value == 'Home') { $('.show_hide').hide(); } } </script> <title>Submit Order Ticket</title> </head> <body> <div id="LogoHeader"> <img src="images/logo.png" /> </div> <div id="Menu"> <? include 'includes/menu.php'; ?> </div> <div class="jQueryErrors"> </div> <div id="OrderForm"> <br /> <form id="submitorderform" action="submitorderticket-action.php" method="post" onsubmit="return validateOrderSubmissionForm();"> <input id="submitneworderticket" name="submitneworderticket" value="submitneworderticket" type="hidden" /> <fieldset> <div class="FormRow"> <div class="FormLabel"> <label for="InsuranceCarrierID">* Insurance Carrier:</label> </div> <div class="FormInput"> <? $CarriersResult = mysql_query("SELECT InsuranceCarriersAgents.InsuranceCarrierID, InsuranceCarriers.InsuranceCarrier FROM InsuranceCarriersAgents LEFT JOIN InsuranceCarriers ON InsuranceCarriersAgents.InsuranceCarrierID = InsuranceCarriers.InsuranceCarrierID WHERE InsuranceCarriersAgents.AgentID = '$AgentID'") or die(mysql_error()); $rowCounter = mysql_num_rows($CarriersResult); if ($rowCounter == 0) { echo '<span style="background-color: #C0C0C0; color: red; padding: 2px;">You Are Not Associated With Any Insurance Carriers, Click On <a href="carrier-agent-correlations.php">Insurance Carriers</a> To Add It/Them.<span>'; } if ($rowCounter > 1) { echo '<select id="InsuranceCarrierID" name="InsuranceCarrierID">'; echo '<option value=""> ... </option>'; } while ($temprow = mysql_fetch_assoc($CarriersResult)) { if ($rowCounter == 1) { echo '<input type="hidden" id="InsuranceCarrierID" name="InsuranceCarrierID" value="'.$temprow['InsuranceCarrierID'].'" />'; echo '<input style="color: #515151;" type="text" id="InsuranceCarrier" name="InsuranceCarrier" value="'.$temprow['InsuranceCarrier'].'" size="50" READONLY />'; } if ($rowCounter > 1) { echo '<option value="'.$temprow['InsuranceCarrierID'].'">'.$temprow['InsuranceCarrier'].'</option>'; } } if ($rowCounter > 1) { echo '</select>'; } ?> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="AgencyID">* Agency Name:</label> </div> <div class="FormInput"> <? $AgenciesResult = mysql_query("SELECT AgenciesAgents.AgencyID, Agencies.AgencyName FROM AgenciesAgents LEFT JOIN Agencies ON AgenciesAgents.AgencyID = Agencies.AgencyID WHERE AgenciesAgents.AgentID = '$AgentID'") or die(mysql_error()); $rowCounter = mysql_num_rows($AgenciesResult); if ($rowCounter == 0) { echo '<span style="background-color: #C0C0C0; color: red; padding: 2px;">You Are Not Associated With Any Agencies, Please Call ParaMedDirect.<span>'; } if ($rowCounter > 1) { echo '<select id="AgencyID" name="AgencyID">'; echo '<option value=""> ... </option>'; } while ($temprow = mysql_fetch_assoc($AgenciesResult)) { if ($rowCounter == 1) { echo '<input type="hidden" id="AgencyID" name="AgencyID" value="'.$temprow['AgencyID'].'" />'; echo '<input style="color: #515151;" type="text" id="AgencyName" name="AgencyName" value="'.$temprow['AgencyName'].'" size="50" READONLY />'; } if ($rowCounter > 1) { echo '<option value="'.$temprow['AgencyID'].'">'.$temprow['AgencyName'].'</option>'; } } if ($rowCounter > 1) { echo '</select>'; } ?> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="AgentID">* Agent Name:</label> </div> <div class="FormInput"> <input type="hidden" id="AgentID" name="AgentID" value="<? echo $AgentID; ?>" /> <input style="color: #515151;" type="text" id="AgentName" name="AgentName" value="<? echo $AgentName; ?>" READONLY /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="InsuranceCarrierPolicyNumber"> Policy Number:</label> </div> <div class="FormInput"> <input id="InsuranceCarrierPolicyNumber" name="InsuranceCarrierPolicyNumber" type="text" value="<? echo $InsuranceCarrierPolicyNumber; ?>" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketFirstName">* Client Name:</label> </div> <div class="FormInput"> <input id="OrderTicketFirstName" name="OrderTicketFirstName" type="text" value="<? echo $OrderTicketFirstName; ?>" required /> <input id="OrderTicketMiddleName" name="OrderTicketMiddleName" type="text" value="<? echo $OrderTicketMiddleName; ?>" size="1" /> <input id="OrderTicketLastName" name="OrderTicketLastName" type="text" value="<? echo $OrderTicketLastName; ?>" required /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketAddress">* Address:</label> </div> <div class="FormInput"> <input id="OrderTicketAddress" name="OrderTicketAddress" type="text" value="<? echo $OrderTicketAddress; ?>" required size="50" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketCity">* City:</label> </div> <div class="FormInput"> <input id="OrderTicketCity" name="OrderTicketCity" type="text" value="<? echo $OrderTicketCity; ?>" required /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketState">* State:</label> </div> <div class="FormInput"> <select id="OrderTicketState" name="OrderTicketState"> <option value=""> ... </option> <? $StateResult = mysql_query("SELECT * FROM States WHERE 1"); while ($StateRow = mysql_fetch_assoc($StateResult)) { echo '<option value="'.$StateRow['StateAbbr'].'"'; if ($StateRow['StateAbbr'] == $OrderTicketState){echo ' SELECTED';} elseif ($StateRow['StateAbbr'] == "MO"){echo ' SELECTED';} echo '>'.$StateRow['State'].'</option>'; } ?> </select> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketZipCode">* Zip Code:</label> </div> <div class="FormInput"> <input id="OrderTicketZipCode" name="OrderTicketZipCode" type="text" value="<? echo $OrderTicketZipCode; ?>" pattern="[0-9]{5}" required /> </div> </div> <br /> <div class="FormRow"> <span style="font-weight: 600;">Enter Exam Location if Different from Client Location.</span> </div> <br /> <div class="FormRow"> <div class="FormLabel" style="padding-left: 15px;"> <label for="OrderTicketExamLocation">Exam Location:</label> </div> <div class="FormInput"> <select id="OrderTicketExamLocation" name="OrderTicketExamLocation" onchange="ShowHide()"> <? $ExamLocationResult = mysql_query("SELECT * FROM ExamLocations"); while ($ExamLocationRow = mysql_fetch_assoc($ExamLocationResult)) { echo '<option value="'.$ExamLocationRow['ExamLocation'].'"'; if ($ExamLocationRow['ExamLocation'] == $OrderTicketExamLocation){echo ' SELECTED';} echo '>'.$ExamLocationRow['ExamLocation'].'</option>'; } ?> </select> </div> </div> <br /> <div class="show_hide"> <div class="FormLabel" style="padding-left: 15px;"> <label for="OrderTicketExamLocationAddress">Exam Location Address:</label> </div> <div class="FormInput"> <input id="OrderTicketExamLocationAddress" name="OrderTicketExamLocationAddress" type="text" value="<? echo $OrderTicketExamLocationAddress; ?>" size="50" /> </div> </div> <br /> <div class="show_hide"> <div class="FormLabel" style="padding-left: 15px;"> <label for="OrderTicketExamLocationCity">Exam Location City:</label> </div> <div class="FormInput"> <input id="OrderTicketExamLocationCity" name="OrderTicketExamLocationCity" type="text" value="<? echo $OrderTicketExamLocationCity; ?>" /> </div> </div> <br /> <div class="show_hide"> <div class="FormLabel" style="padding-left: 15px;"> <label for="OrderTicketExamLocationState">Exam Location State:</label> </div> <div class="FormInput"> <select id="OrderTicketExamLocationState" name="OrderTicketExamLocationState"> <option value=""> ... </option> <? $StateResult = mysql_query("SELECT * FROM States"); while ($StateRow = mysql_fetch_assoc($StateResult)) { echo '<option value="'.$StateRow['StateAbbr'].'"'; if ($StateRow['StateAbbr'] == $OrderTicketExamLocationState){echo ' SELECTED';} elseif ($StateRow['StateAbbr'] == "MO"){echo ' SELECTED';} echo '>'.$StateRow['State'].'</option>'; } ?> </select> </div> </div> <br /> <div class="show_hide"> <div class="FormLabel" style="padding-left: 15px;"> <label for="OrderTicketExamLocationZipCode">Exam Location Zip Code:</label> </div> <div class="FormInput"> <input id="OrderTicketExamLocationZipCode" name="OrderTicketExamLocationZipCode" type="text" value="<? echo $OrderTicketExamLocationZipCode; ?>" pattern="[0-9]{5}" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketHomePhone">* Home Phone:</label> </div> <div class="FormInput"> <input id="OrderTicketHomePhone" name="OrderTicketHomePhone" type="tel" value="<? echo formatPhone($OrderTicketHomePhone); ?>" required /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketWorkPhone"> Work Phone:</label> </div> <div class="FormInput"> <input id="OrderTicketWorkPhone" name="OrderTicketWorkPhone" type="tel" value="<? echo formatPhone($OrderTicketWorkPhone); ?>" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketMobilePhone"> Mobile Phone:</label> </div> <div class="FormInput"> <input id="OrderTicketMobilePhone" name="OrderTicketMobilePhone" type="tel" value="<? echo formatPhone($OrderTicketMobilePhone); ?>" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketEmailAddress"> Email Address:</label> </div> <div class="FormInput"> <input id="OrderTicketEmailAddress" name="OrderTicketEmailAddress" type="email" size="50" value="<? echo $OrderTicketEmailAddress; ?>" /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketDOBMonth">* Date of Birth:</label> </div> <div class="FormInput"> <select id="OrderTicketDOBMonth" name="OrderTicketDOBMonth"> <option value=""> ... </option> <? for ($i=1;$i<13;$i++) { $i = sprintf('%02d', $i); echo '<option value="'.$i.'"'; if ($i == $OrderTicketDOBMonth) {echo ' SELECTED';} echo '>'.$i.'</option>'; } ?> </select> <select id="OrderTicketDOBDay" name="OrderTicketDOBDay"> <option value=""> ... </option> <? for ($i=1;$i<32;$i++) { $i = sprintf('%02d', $i); echo '<option value="'.$i.'"'; if ($i == $OrderTicketDOBDay) {echo ' SELECTED';} echo '>'.$i.'</option>'; } ?> </select> <select id="OrderTicketDOBYear" name="OrderTicketDOBYear"> <option value=""> ... </option> <? $thisYear = date('Y'); for ($i=1900;$i<$thisYear;$i++) { echo '<option value="'.$i.'"'; if ($i == $OrderTicketDOBYear){echo ' SELECTED';} echo '>'.$i.'</option>'; } ?> </select> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketGender">* Gender:</label> </div> <div class="FormInput"> <select id="OrderTicketGender" name="OrderTicketGender"> <option value=""> ... </option> <option value="Male" <? if ($OrderTicketGender == "Male"){echo ' SELECTED';} ?>>Male</option> <option value="Female" <? if ($OrderTicketGender == "Female"){echo ' SELECTED';} ?>>Female</option> </select> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketSmoker">* Tobacco User:</label> </div> <div class="FormInput"> <select id="OrderTicketSmoker" name="OrderTicketSmoker"> <option value=""> ... </option> <option value="Yes" <? if ($OrderTicketSmoker == "Yes"){echo ' SELECTED';} ?>>Yes</option> <option value="No" <? if ($OrderTicketSmoker == "No"){echo ' SELECTED';} ?>>No</option> <option value="NA" <? if ($OrderTicketSmoker == "NA"){echo ' SELECTED';} ?>>Not Applicable</option> </select> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketPolicyType">* Policy Type:</label> </div> <div class="FormInput"> <select id="OrderTicketPolicyType" name="OrderTicketPolicyType"> <option value=""> ... </option> <option value="LifeTerm" <? if ($OrderTicketPolicyType == "LifeTerm"){echo ' SELECTED';} ?>>Life (term)</option> <option value="LifeVariable" <? if ($OrderTicketPolicyType == "LifeVariable"){echo ' SELECTED';} ?>>Life (variable)</option> <option value="Disability" <? if ($OrderTicketPolicyType == "Disability"){echo ' SELECTED';} ?>>Disability</option> <option value="Health" <? if ($OrderTicketPolicyType == "Health"){echo ' SELECTED';} ?>>Health</option> <option value="LTC" <? if ($OrderTicketPolicyType == "LTC"){echo ' SELECTED';} ?>>LTC</option> </select> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketPolicyAmount">* Policy Amount:</label> </div> <div class="FormInput"> <input id="OrderTicketPolicyAmount" name="OrderTicketPolicyAmount" type="text" value="<? if ($OrderTicketPolicyAmount != 0) echo number_format($OrderTicketPolicyAmount, 2); ?>" required /> </div> </div> <br /> <div class="FormRow"> <div class="FormLabel"> <label for="OrderTicketSpecialInstructions"> Special Instructions:</label> </div> <div class="FormInput"> <textarea id="OrderTicketSpecialInstructions" name="OrderTicketSpecialInstructions" cols="40" rows="7"><? echo $OrderTicketSpecialInstructions; ?></textarea> </div> </div> <br /> <div class="FormRow"> <div class="FormSubmit"> <input id="submit" type="submit" value="Submit" /> </div> </div> <br /> </fieldset> <div id="sitesealdiv"> <span id="siteseal"><script type="text/javascript" src="https://seal.godaddy.com/getSeal?sealID=nezI8DdJpwJdyKY47vVrSgFuL1UYVfwDggv4JN4ykS5AumDDidYzrl"></script></span> </div> </form> </div> </body> </html>
  14. I have this bellow code its a jquery to add form elements dynamically. my question is when Im submiting the form to the database it only send first set of elements value only, rest are not sending to the database, plz help me on this.. here is my codes. jquery- <script type="text/Javascript"> $(document).ready(function() { $('#btnAdd').click(function() { var num = $('.clonedSection').length; var newNum = new Number(num + 1); var newSection = $('#pq_entry_' + num).clone().attr('id', 'pq_entry_' + newNum); newSection.children(':first').children(':first').attr('id', 'contNo_' + newNum).attr('name', 'contNo_' + newNum); newSection.children(':nth-child(2)').children(':first').attr('id', 'contNo2_' + newNum).attr('name', 'contNo2_' + newNum); newSection.children(':nth-child(3)').children(':first').attr('id', 'contNo3_' + newNum).attr('name', 'contNo3_' + newNum); newSection.children(':nth-child(4)').children(':first').attr('id', 'contNo4_' + newNum).attr('name', 'contNo4_' + newNum); newSection.children(':nth-child(5)').children(':first').attr('id', 'contNo5_' + newNum).attr('name', 'contNo5_' + newNum); newSection.children(':nth-child(6)').children(':first').attr('id', 'contNo6_' + newNum).attr('name', 'contNo6_' + newNum); newSection.insertAfter('#pq_entry_' + num).last(); $('#btnDel').prop('disabled',''); if (newNum == 5) $('#btnAdd').prop('disabled','disabled'); }); $('#btnDel').click(function() { var num = $('.clonedSection').length; // how many "duplicatable" input fields we currently have $('#pq_entry_' + num).remove(); // remove the last element // enable the "add" button $('#btnAdd').prop('disabled',''); // if only one element remains, disable the "remove" button if (num-1 == 1) $('#btnDel').prop('disabled','disabled'); }); $('#btnDel').prop('disabled','disabled'); }); //$('#blinfo').on('submit', function (e) { //prevent the default submithandling // e.preventDefault(); //send the data of 'this' (the matched form) to yourURL // $.post('bladd.php', $(this).serialize()); //}); </script> Here is the HTML (both codes are in the same file) <ul id="pq_entry_1" class="clonedSection"> <li><input type="text" name="contNo_1" id="contNo_1" size="45" value=""/></li> <li>SIZE<input type="text" name="contNo2_1" id="contNo2_1" size="15" value=""/></li> <li>MODE<input type="text" name="contNo3_1" id="contNo3_1" size="15" value=""/></li> <li>PICES<input type="text" name="contNo4_1" id="contNo4_1" size="15" value=""/></li> <li>WEIGHT<input type="text" name="contNo5_1" id="contNo5_1" size="15" value=""/></li> <li>VOLUME<input type="text" name="contNo6_1" id="contNo6_1" size="15" value=""/></li> </ul> <input type='button' id='btnAdd' size="15" value='add another row' /><input type='button' id='btnDel' value='delete row' /> and here is my sql query <?php $con=mysqli_connect("localhost","root","1234","shipping"); // Check connection if (mysqli_connect_errno()) { mysqli_connect_error(); } $sql="INSERT INTO infobl (contNo_1, contNo2_1, contNo3_1, contNo4_1, contNo5_1, contNo6_1, contNo_2, contNo2_2, contNo3_2, contNo4_2, contNo5_2, contNo6_2, datetime) VALUES ('$_POST[contNo_1]','$_POST[contNo2_1]','$_POST[contNo3_1]','$_POST[contNo4_1]','$_POST[contNo5_1]','$_POST[contNo6_1]','$_POST[contNo_2]','$_POST[contNo2_2]','$_POST[contNo3_2]','$_POST[contNo4_2]','$_POST[contNo5_2]','$_POST[contNo6_2]',NOW())"; if (!mysqli_query($con,$sql)) { die('<font color="#FF0000"><h2>Error: ---PLEASE CHECK YOUR NUMBER AGAIN....<br />Press Back on the browser.... </h2></font>' . mysqli_error($con)) ; } else header('location: /bldrft/edits/view.php'); mysqli_close($con); ?> I can't figure it out what was the wrong, all are fine to me, plzz help guys. thanks.
  15. Hello, I am using a component for joomla 2.5 but i hit snag where it comes to selecting the categories from a drop down box in the front end. I want to use the disabled element for the top category options so that they are visible but unselectable. Something like this: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_option_disabled The component uses the following code to hide certain categories of my choosing but i don't want to hide them i just want to add the HTML element "disabled" to the corresponding options: $options = JHTML::_('category.options','com_content',array('filter.published' => 1 )); require_once(JPATH_COMPONENT_SITE.DS.'config'.DS.'restrictions.php'); $myGroups = $acl->getGroupsByUser($my->id,false); foreach($myGroups as $gid) { if(isset($groupRestrictions[$gid])) { foreach($options as $k=>$option) { if(in_array( $option->value, $groupRestrictions[$gid] )) { unset($options[$k]); } } } } $opt = array('value'=>0,'text'=>JText::_('JOPTION_SELECT_CATEGORY')); array_unshift($options,$opt); return JHTML::_('select.genericlist',$options,'catid',"class='inputbox'",'value','text',$categoryId); } Any help is gratefully appreciated.
  16. So what i am trying to do is based on a administrative section of the website to edit pictures in a section of the website. the page displays all the images in the database, each image has 3 inputs to them, all based under one form for all pictures. so each picture has two checkboxes and one number input. First checkbox is based on if the picture will be active or not for displaying on the website. second input is the order of when this picture will be displayed ( yes this is for a feature banner that changes images based on time ). the last input is the second checkbox for deleting the photo(this checkbox is working fine as it uses a different submit button). I have this page set up so it will have all the active pictures already checked. now when trying to "uncheck" the active picture, it will not change the status of active. I will provide the code for the whole thing, maybe im going about this the wrong way. just mainly need some direction on how to go about what im trying to accomplish. my database layout: NAME: feature | id | position | pic | active | ======================== | 1 | 3 | jpg | true | | 2 | 1 | jpg | true | | 3 | NULL | jpg | false | | 4 | 2 | jpg | true | <form method="post" id="delete" name="delete"> <?php $pic_query = mysqli_query($con, "SELECT * FROM feature") or die("Pic_Query Failed: ".mysqli_error($con)); $count = mysqli_num_rows($pic_query); while($row = mysqli_fetch_array($pic_query)){ extract($row); if($active=='true'){ $checked = 'checked'; }else{ $checked = NULL; } ?> <div style="display:inline-block; margin: 4px; padding:5px; border:solid 1px #000000; border-radius:5px;"> <img src="../images/feature/<?php echo $pic ?>" width="200px"> <br>Active: <input type="checkbox" id="active[<?php echo $id ?>]" name="active[]" value="true" <?php echo $checked ?>> <br>Position: <input type="number" id="pos[<?php echo $id ?>]" name="pos[]" min="1" max="5" value="<?php echo $position; ?>"> <br>Delete: <input type="checkbox" id="checkbox[<?php echo $id; ?>]" name="checkbox[]" value="<?php echo $id; ?>"> </div> <?php } if(isset($_POST['delete'])){ for($i=0;$i<count($_POST['checkbox']);$i++){ $checkbox = $_POST['checkbox']; $del_id = $checkbox[$i]; $byebye = mysqli_query($con, "SELECT * FROM feature WHERE id='$del_id'") or die("File Delete Error: ".mysqli_error($con)); while($rows = mysqli_fetch_array($byebye)){ extract($rows); unlink("../images/features/".$pic); } $sql = "DELETE FROM pictures WHERE id='$del_id'"; $result = mysqli_query($con, $sql) or die("Delete Error: ".mysqli_error($con)); } // if successful redirect to delete_multiple.php if($result){ echo "<meta http-equiv=\"refresh\" content=\"0;URL=feature-pics.php\">"; } } mysqli_close(); if(isset($_POST['activate'])){ for($n=0;$n<count($_POST['active']);$n++){ $live = $_POST['active'][$n]; $pos = $_POST['pos'][$n]; $act_id = $active[$n]; $update = "UPDATE feature SET position='$pos', active='$live' WHERE id='$act_id'"; $result = mysqli_query($con, $update) or die("Active Error: ".mysqli_error($con)); echo "<br>".$live; //Testing whats being sent echo "<br>".$pos; //Testing whats being sent } // if successful redirect to delete_multiple.php if($result){ echo "" //meta refresh here, took out for testing } } mysqli_close(); ?> <br> <input type="submit" name="activate" id="activate" value="Activate"> <input type="submit" name="delete" id="delete" value="Delete Selected"> </form>
  17. To be honest I am sure this is something simple that I am missing or just not understanding. What I am trying to do is use a dropdown menu to make a selection to search a db and display the results. The php portion works fine as I have hard coded the search criteria into it and it displays the results just fine. I can also use a plain text box and type the search string in with it displaying the results as well. Just not sure what I am doing wrong on the dropdown menu form/ Here is the for code I am using. <html> <head> <title>Untitled Document</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> function get() { $('#data').hide(); $.post('data.php', { name: form.name.value }, function (output) { $('#data').html(output).fadeIn(1000); }); } </script> </head> <body bgcolor="#2E64FE"> <p></p> <p></p> <form action=""><select name="genetics"> <option value="Item1">Item1</option> <option value="Item2">Item2</option> <option value="Item3">Item3</option> <option value="Item4">Item4</option> </select><input type="hidden" name="option value" /> <input type="button" value="Search" onclick="get();" /> <div id="data"></div> </form> </body> </html Any help or direction would be great, Thanks in advance!
  18. Disclaimer: This is my first attempt at doing anything with php, which might be overkill for what's required. Many of the pages of our website have one or more products with multiple selections (drop-down lists). Quite a few orders come in without a selection for one of the critical choices, which necessitates contacting the customer and waiting for a reply. A script which validates required fields could make things run much more smoothly for everyone. I've downloaded such a script and attempted to validate just one list (outside color) but have been unable to get the validation to work. Any guidance will be much appreciated. The files in question are attached for convenience. formvalidator.php 111-php-test.html
  19. <?php $user="root"; $password=""; $database="base"; $host="localhost"; $table="com"; mysql_connect($host, $user, $password) or die("error"); mysql_select_db($database) or die("error"); $name = $_POST['name']; $lastname = $_POST['lastname']; $email = $_POST['email']; $coment= $_POST['coment']; $error = ''; if(empty($name) || empty($lastname) || empty($email) || empty($coment)) { $error .= 'error. '; } if(!preg_match("/^[a-zA-A]+$/i", $name)) { $error .= 'Error '; } if(!preg_match("/^[a-zA-A]+$/i", $lastname)) { $error .= 'Error '; } if(!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email)) { $error .= 'errorl. '; } if(!preg_match("/^[a-zA-z0-9.,?!]+$/i", $comment)) { $error .= 'Error '; } if($error == '') { $result = "INSERT INTO com (name, lastname, email, coment) VALUES('$name', '$lastname', '$email','$coment')"; echo "<script type='text/javascript'>alert('Thanks.'); window.close();</script>";} else{ echo"<script type='text/javascript'>alert ('$error'); window.close(); </script>";} Errors seems to be working its just it won't insert data in table in mysql database.... Thank you so much.
  20. Hi, I am trying to set up a PIN protected area of my website. What I mean by that would be a simple pop up window similar to the usual php authentication pop-up window by most browser however where only a password is necessary to access the website - no username required. Would any of you know if this will be possible to do in php or any other language? Thank you. John
  21. Hey everyone. I am farly new to PHP and MySQL so I do say sorry in advance for any stupid lines of code I have written. But I am stuck at a point in a website im making for a friend. I have a database with a unknown amount of entries. I have currently found a way to make a list of entries appear in a table. and add a edit button to edit each entry separately on another page however what I would like is a table with all the entries in so they can admin all the entries without having to go though phpmyadmin I know it has something to do with arrays. But i cant seem to find a simple explanation for what im wanting to do So im hoping someone here can either give me a link to something that will help. or explain it to me in simple terms. Thanks in advance PomTom I can provide code if required from my other working pages but i figured since its a new page im making theres no code written to provide
  22. I need some assistance changing a single select into a multiple select form drop-down. I am having issues with the multiple selections storing. Thank you for your help! $var = " <script type='text/javascript'> jQuery(function(){ jQuery('form').attr('method', 'get'); jQuery('form').after('<input type=\"submit\" id=\"doaction_k2\" class=\"button-secondary action\" value=\"Apply Folder Access\" style=\"background: red; color: #fff;\">'); var thisurl = ''; var thaturl = ''; jQuery('#doaction_k2').live('click', function(){ jQuery('.new_file_access').each(function(){ thisurl = thisurl + '|' + jQuery(this).attr('userid') + '~' + jQuery(this).val(); }); jQuery('.new_file_readwrite').each(function(){ thaturl = thaturl + '|' + jQuery(this).attr('userid') + '~' + jQuery(this).val(); }); jQuery.post(document.URL, { update_access: 1, file_access: thisurl, file_readwrite: thaturl }, function(){ window.location = document.URL; }); return false; }); }); </script>"; } $var .= "<select multiple='yes' id='file_manager_accessk".$user_id."[]' class='new_file_access' userid='$user_id'><option value='' $noaccess>No Access</option>"; foreach($ACCESS_ARRAY as $key=>$value) { $key = str_replace('\\', '/', $key); $keys = $key .'~'. $urls.'/'.$value; $keys = substr($keys, 0, strlen($keys)-1); $keys1 = base64_encode($keys); $var .= "<option value='$keys1' $select[$keys]>$value</option>"; } $var .= "</select>"; return $var; ~ Sarah
  23. Hi, I have a phpform where people can upload papers but they also need to fill in a little textbox with information about the paper. Most people copy some text from the word file straight into the textbox but if there are some quotes in it and you press submit you always get a Bad Request error page. The thing is if you go to the textbox and you replace the copied quotes with quotes you type yourself it works. I know there are some problems with these "smart quotes" but i put some phpcode to replace the smart quotes with normal quotes: $paperinfo = str_replace( array("\xe2\x80\x98", "\xe2\x80\x99", "\xe2\x80\x9c", "\xe2\x80\x9d", "\xe2\x80\x93", "\xe2\x80\x94", "\xe2\x80\xa6"), array("'", "'", '"', '"', '-', '--', '...'), $paperabstract); $paperinfo = str_replace( array(chr(145), chr(146), chr(147), chr(148), chr(150), chr(151), chr(133)), array("'", "'", '"', '"', '-', '--', '...'), $paperabstract); but still it isn't working. Also when i use the correct quotes and press submit it first checks for empty fields but if i use the copied quotes it isn't even checking which fields are empty it goes straight to the bad request page. Hope somebody can help me with this problem.
  24. Hello, I would like to solve form problem. Here is my code: /************************** Step 1: Select Cell************************************/ if(isset($_POST['SmartPhone'])) $checked1=$_POST['SmartPhone']; $form->add_checkbox('SmartPhone','SmartPhone',$checked1); if(isset($_POST['Apple'])) $checked2=$_POST['Apple']; $form->add_checkbox('Apple','Apple',$checked2); /************************** Step 2: Select Model************************************/ if($_POST['SmartPhone']==false and $_POST['Apple']==false) { $this->add(new error('<span style="color:red">Select your cell..!!</span>')); $this->step1(); return; } if(isset($_POST['S4'])) $tech2=$_POST['S4']; $form->add_checkbox('S4','S4',$tech2); if(isset($_POST['iPhone 5'])) $tech3=$_POST['iPhone 5']; $form->add_checkbox('iPhone_5','iPhone 5',$tech3); if(isset($_POST['iPhone 5s'])) $tech1=$_POST['iPhone 5s']; $form->add_checkbox('iPhone_5s','iPhone 5s',$tech1); //In addition, i want to know how to put "Select All" button here // in order to SELECT ALL MODELs: S4, iPhone 5, iPhone_5s /************************** Step 3: File Generation************************************/ if($_POST['S4']==false and $_POST['iPhone_5']==false and $_POST['iPhone_5s']==false) { $this->add(new error('<span style="color:red">Please enter your model..!</span>')); $this->step2(); return; } $date = date('Y-m-d_H-i-s'); // Filename should be like this format "cell_datetime.xml" // For example: SmartPhone_20130910183023.xml or Apple_20130910183023.xml // Any idea how to create such filename?? Thanks for your time.
  25. Hi everybody, I am writing an inventory system using PHP+MySQL. The system provides simple functions like Insert, Display, Update and Delete for the user to choose in Page 1. However, for Display, Update and Delete, users then have to enter the product ID in page 2, but not for the Insert function, which should directly jump to Page 3 for inserting the item specifics. As the different functions can go to different pages, in Page 1, I don't think I shall put all these function choices as radio buttons in the same form. One solution is to implement these 4 choices as 4 submit buttons, i.e. 4 forms are created. However, to differentiate among Display, Update and Delete, I need the HTML of Page 1 to carry some values to Page 2 depending on which submit button is being chosen, but apart from the choice of the 4 functions, users do not need to input anything else in Page 1. Hence I need a hidden input type, like this: <form name='1' action='Page3.php' method='post'> <!-- Insert will skip Page 2 --> <input type='Submit' value='Insert'> </form> <form name='2' action='Page2.php' method='post'> <input type='hidden' name='function' value='Display'> <input type='Submit' value='Display'> </form> <form name='3' action='Page2.php' method='post'> <input type='hidden' name='function' value='Update'> <input type='Submit' value='Update'> </form> <form name='4' action='Page2.php' method='post'> <input type='hidden' name='function' value='Delete'> <input type='Submit' value='Delete'> </form> So in Page 2, I can know which button is clicked from $_POST['function']. I believe this works, but is it a good practice? If not, is there any better solution? Thanks! -- pengi <(")
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.