Psycho
Moderators-
Posts
12,157 -
Joined
-
Last visited
-
Days Won
129
Everything posted by Psycho
-
I can't for the life of me move from mysql_* to prepared queries
Psycho replied to r3wt's topic in PHP Coding Help
I'll second all of the preceeding comments. I'm at a loss as to how you ended up with that code considering you are a "decent" programmer. Sorry if that is harsh, but there's nothing worse than someone who overestimates their own abilities. It is from knowing your weakness that people are open to improvement. I hope you take the comments here as constructive criticism to improve. I *think* the issue is that you have gotten into a comfort zone using functions and processes that you learned to use and rather than learn new and better ways to accomplish things you keep falling back to what you know. So, having said that, I see something in the code above that doesn't make sense. The table 'Wallets' apparently has an Id field and a Market_Id field. Ok, The Trade_History table also has a field named Market_Id. Ok, no problem. But, when you are running the inner query (which you shouldn't since you should have a JOIN) you are getting records from the Trade_History table where the Market_Id in that table matches the Id from the 'Wallets' table. That doesn't make sense. It would seem appropriate to associate the records based on the Market_Id. Either you are using the wrong value or the names of the fields in the tables are less than desirable. One other tip. The code above uses a lot of lines just to retrieve individual values and assign to variables. There's no need to assign something to a variable if it is only going to be used one on the next line or two. -
<?php //Define default data $message = "test"; $fromEmail = "john@gmail.com"; $carriers = array( 'verizon' => 'Verizon', 'tmobile' => 'T-Mobile', 'sprint' => 'Sprint', 'att' => 'AT&T', 'virgin' => 'Virgin Mobile' ); //Parse post data - if sent //Remove any non-numeric characters from phone number $number = isset($_POST['number']) ? preg_replace('#[^\d]#', '', $_POST['number']) : false; //Define the carrier $carrier = isset($_POST['carrier']) ? $_POST['carrier'] : false; $responseMessage = false; if(isset($_POST['number'])) { //Test the length of the number if(strlen($number) != 10) { //Phone number is not 10 digits $responseMessage = "Error: You must enter a 10 digit number for the recipient."; } else { //Determine the phone number format switch($carrier) { case 'verizon': $formatted_number = $number."@vtext.com"; break; case 'tmobile': $formatted_number = $number."@tomomail.net"; break; case 'sprint': $formatted_number = $number."@messaging.sprintpcs.com"; break; case 'att': $formatted_number = $number."@txt.att.net"; break; case 'virgin': $formatted_number = $number."@vmobl.com"; break; default: $responseMessage = "Error: Invalid or no carrier selected."; } } //If formatted number is set, attempt to send message if(isset($formatted_number)) { if(!mail($formatted_number, "", $message, "From: {$fromEmail}")) { $responseMessage = "Error: There was a problem sending the message."; } else { $responseMessage = "Success: Message was sent."; } } } //Create the carrier options $options = ''; foreach($carriers as $carrierID => $carrierName) { $selected = ($carrierID==$carrier) ? ' selected="selected"' : ''; $options .= "<option value='{$carrierID}'{$selected}>{$carrierName}</option>"; } ?> <html> <head></head> <body> <?php echo $responseMessage; ?> <br><br> <form id="sms" name="sms" method="post" action=""> <table width="400"> <tr> <td align="right" valign="top">Cell number:</td> <td align="left"><input name="number" type="text" id="number" size="10" value="<?php echo $number; ?>"></td> </tr> <tr> <td align="right" valign="top">Carrier:</td> <td align="left"> <select name="carrier" id="carrier"> <?php echo $options; ?> </select> </td> </tr> <tr> <td colspan="2" align="right"><button type="submit">Submit</button></td> </tr> </table> </form> </body> </html>
-
I have no clue what you are talking about. Plus, PHP3 is almost 15 years old. Why would you want to run something on PHP3?
-
Jumping in the deep end of the pool to learn swimming.
Psycho replied to OrionSuperman's topic in Introductions
Have you ever considered a lawsuit against your parents? Just saying. I use the pseudonym "Psycho", but I'd never refer to that as my 'name'. Don't get me wrong, I love working with PHP. But, you probably shouldn't focus on PHP when looking for a job. Many employers will post jobs looking for specific skill sets, but from my personal experience (in hiring) the main focus in on general programming capabilities. As different projects come up they may require different technologies. I think this is especially true of junior level programmers who won't have a lot of specific experience to represent them. -
To add to mogosselin's response, you would also put a value attribute in the field like so: <label for="email">Your Email</label> <input id="email" value="" name="email" placeholder="email@company.com" value="<?php echo $mail; ?>"> Now, to expand to that, here is what I would do: On the wo_edit.php page, I would remove the code to build the form and simply use an include(). $query = "SELECT * FROM workorderstbl WHERE wo_id = :wo_id LIMIT 1"; $poststmt = $DBH->prepare($query); $wo_id = intval($_GET['id']); $poststmt->bindParam(':wo_id', $wo_id, PDO::PARAM_STR, 5); $poststmt->execute(); if(!$poststmt->rowCount()) { echo 'Work Order #{$wo_id} not found'; $DBH = null; } else { $workOrder = $poststmt->fetch(PDO::FETCH_ASSOC); include('wo_form.php'); } Then on the wo_form.php page, I would define variables for the form at the top of the script based upon whether values were passed to the script or use empty values. Then include those variables in the form. Example: <?php $wo_id = isset($workOrder['wo_id']) ? htmlentities($workOrder['wo_id']) : ''; $date_posted = isset($workOrder['date_posted']) ? date('F j<\s\up>S</\s\up>, Y', $row['date_posted']) : ''; $wo_status = isset($workOrder['wo_status']) ? htmlentities($workOrder['wo_status']) : ''; $first_name = isset($workOrder['first_name']) ? htmlentities($workOrder['first_name']) : ''; $last_name = isset($workOrder['last_name']) ? htmlentities($workOrder['last_name']) : ''; $phone_number = isset($workOrder['phone_number']) ? htmlentities($workOrder['phone_number']) : ''; $email_addr = isset($workOrder['email_addr']) ? htmlentities($workOrder['email_addr']) : ''; $strt_addr = isset($workOrder['strt_addr']) ? htmlentities($workOrder['strt_addr']) : ''; $strt_addr2 = isset($workOrder['strt_addr2']) ? htmlentities($workOrder['strt_addr2']) : ''; $city = isset($workOrder['city']) ? htmlentities($workOrder['city']) : ''; $state = isset($workOrder['state']) ? htmlentities($workOrder['state']) : ''; $zip = isset($workOrder['zip']) ? htmlentities($workOrder['zip']) : ''; $service_type = isset($workOrder['service_type']) ? htmlentities($workOrder['service_type']) : ''; $request_date = isset($workOrder['m-d-Y']) ? date('F j<\s\up>S</\s\up>, Y', $row['request_date']) : ''; $request_time = isset($workOrder['request_time']) ? htmlentities($workOrder['request_time']) : ''; $service_time = isset($workOrder['service_time']) ? htmlentities($workOrder['service_time']) : ''; $service_notes = isset($service_notes['zip']) ? nl2br(htmlentities($service_notes['zip'])) : ''; ?> <legend>Contact Info</legend> <form id='wo_edit' action='wo_view.php' method='post'> <a href="wo_view.php?id=<?php echo $wo_id; ?>" style='float: left;'>Back to Service Request</a><br /><br /> Service Request: <strong><span id='wo_id'><?php echo $wo_id; ?></span></strong>     Created On: <strong><?php echo $date_posted; ?></strong>     Service Request Status: <select id='wo_status'> <option value='<?php echo $wo_status; ?>'>--<?php echo $wo_status; ?>--</optino> <option value='New'>New</option> <option value='Scheduled'>Scheduled</option> <option value='Pending'>Pending</option> <option value='Closed'>Complete</option> </select><br /> First Name: <input type='text' id='first_name' value='<?php echo $first_name; ?>' />     Last Name: <input type='text' id='last_name' value='<?php echo $last_name; ?>' /><br /> Phone Number: <input type='tel' id='phone_number' value='<?php echo $phone_number; ?>' />     Email Address: <input type='email' id='email_addr' value='<?php echo $email_addr; ?>' /></strong> <fieldset> <legend>Address</legend> Address Line 1: <input type='text' id='strt_addr' value='<?php echo $strt_addr; ?>' /> Address Line 2: <input type='text' id='strt_addr2' value='<?php echo $strt_addr2; ?>' /></br> City: <input type='text' id='city' value='<?php echo $city; ?>' /> State: <input type='text' id='state' value='<?php echo $state; ?>' /> Zip-Code: <input type='number' id='zip' value='<?php echo $zip; ?>' /></strong><br /> </fieldset> <fieldset> <legend>Service Information:</legend> Service Type: <select id='service_type'> <option value='<?php echo $service_type; ?>'>--<?php echo $service_type; ?>--</option> <option value='Install'>Install</option> <option value='Service Call'>Service Call</option> <option value='Repair'>Repair</option> </select>     Request Date: <strong><?php echo $request_date; ?></strong>     Requested Time Frame: <strong><?php echo $request_time; ?></strong><br /> <label for='inputDate'>Service Date:</label> <input class='inputDate' id='inputDate' name='inputDate' /> <input type='checkbox' checked='checked' /> <label id='closeOnSelect' style='display: none;'>Close on selection</label>     Service Time: <input type='time' value='<?php echo $service_time; ?>' /> Service Notes:<br /> <textarea id='service_notes' style='width: 100%;'><?php echo service_notes; ?></textarea><br /> <input type='submit' value='Update' /> </fieldset> </form>
-
Your code is a little hard to read because of the way you are creating the HTML output.. I would propose a suggestion. Make the form a separate file that you include. Then, make that file such that it is mostly HTML and just change to PHP when outputting variables. So, instead of this unreadable mess echo "<label for='wo_id'>Service Request: <strong><span id='wo_id'>" . $row['wo_id'] . "</span></strong>     Created On: <strong>" . date('F j<\s\up>S</\s\up>, Y', $row['date_posted']). "</strong>     Service Request Status: <select id='wo_status'><option value='" . $row['wo_status'] . "'>--" . $row['wo_status'] . "--</optino><option value='New'>New</option><option value='Scheduled'>Scheduled</option><option value='Pending'>Pending</option><option value='Closed'>Complete</option></select><br />"; echo "First Name: <input type='text' id='first_name' value='" . $row['first_name'] . "' />     Last Name: <input type='text' id='last_name' value='" . $row['last_name'] . "' /><br />"; You would have this <label for='wo_id'> Service Request: <strong><span id='wo_id'><?php echo $row['wo_id']; ?></span></strong>     Created On: <strong><?php echo date('F j<\s\up>S</\s\up>, Y', $row['date_posted']); ?></strong>     Service Request Status: <select id='wo_status'> <option value='<?php echo $row['wo_status']; ?>'>--<?php echo $row['wo_status']; ?>--</optino> <option value='New'>New</option> <option value='Scheduled'>Scheduled</option> <option value='Pending'>Pending</option> <option value='Closed'>Complete</option> </select><br /> First Name: <input type='text' id='first_name' value='<?php echo $row['first_name']; ?>' />     Last Name: <input type='text' id='last_name' value='<?php echo $row['last_name']; ?>' /><br /> You'll notice you have an opening tag for the label - but there is no closing tag! There could be other such syntax errors that are causing problems with the form submission, but it is near impossible to "see" them in the current code. Also, you should not use this to determine if the user has submitted the form if(isset($_POST['submit'])) { . . . because it is only set if the user "clicks" on the submit button. A form can be submitted using the Enter key and that vallue may not be sent based upon the browser. A better method is to check the request method (or at least check for one of the form fields) if($_SERVER['REQUEST_METHOD']=="post") (Note sure if it should be "post" or "POST") So, my guess is that there are syntax problems in the form. But, you should at least verify what IS being sent to the processing page. Put this at the top of the script to see if anything is getting sent echo "POST data: <pre>" . print_r($_POST, 1) . "</pre>\n"; EDIT: Last tip. If you do need to create the output using multiple lines of echo statements you should include actual linebreaks in that output to make reading of the HTML easier.If you do this echo "Line 1 content<br>"; echo "Line 2 content<br>"; echo "Line 3 content<br>"; The HTML output would look like this Line 1 content<br>Line 2 content<br>Line 3 content<br> Not too hard to read with just that little bit of content. But, if it is something more complex like a form or table it can be very difficult to follow when trying to debug an issue. So, if you include linebreaks in the output like this (i.e. "\n") echo "Line 1 content<br>\n"; echo "Line 2 content<br>\n"; echo "Line 3 content<br>\n"; The output becomes much easier to read for errors Line 1 content<br> Line 2 content<br> Line 3 content<br>
-
I don't see the actual login script. That is where you need to start. You are apparently only checking the value of $_SESSION['logged_in'] to determine if the user is logged in or not. I assume that is a simple Boolean value (i.e. True/false). Instead, you should store the User ID within the Session data. You can then use that for both determining if the user is logged in AND to query additional details about the logged in user if you wish. However, if you plan on using the "Welcome [firstname]" on many of the pages, then you might as well store that in the session data when the user logs in as well. Don't query the database on every page load for the same information if you don't need to. So, in your login script, change it so it stores the user ID and the user's first name in session data. E.g.: $_SESSION['user_id'] and $_SESSION['user_fname'] Then change this in your index.php script if (isset($_SESSION['logged_in'])){ To: if (isset($_SESSION['user_id'])){ Then on the loggedin.php script use something like this Welcome, <?php echo $_SESSION['user_fname']?>! <a href="logout.php"> Logout </a>
-
OK, I've looked at your code and there seemed to be quite a few problems. For example, you were using mysql and mqsqli functions. I have rewritten it as two functions. One to get the data from the database and another one to create/output the CSV file. That way you can reuse the output CSV function for other datasets as needed. <?php function getInvoerData() { //Connect to database $con = mysqli_connect("localhost", "root", "root", "formulier"); //Check if connection failed if (!$con) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); exit; } //Create and run query to get the data $ID = intval($IDnummer_E); $Achternaam = mysqli_real_escape_string($con, $Achternaam_E); $query = "SELECT * FROM invoer WHERE IDnummer = '{$ID}' AND Achternaam = '{$Achternaam}'"; $result = mysqli_query($con, $query); //Check if query failed if(!$result) { echo 'Could not run query: ' . mysqli_error($con); exit; } //Put data into array $data = array(); while($row = mysqli_fetch_assoc($result)) { $data[] = $row; } return $data; } function csv_export($data, $baseName) { //Add a time stamp to file name, to avoid duplicates $date = new DateTime(); $ts = $date->format('Y-m-d His'); //Note: file names cannot have ':' $filename = "{$baseName}_{$ts}.csv"; //Set header to expect a CSV file and bring up the save dialog header("Content-Type: text/csv"); header("Content-Disposition: attachment; filename={$filename}"); header("Pragma: no-cache"); header("Expires: 0"); //Open up the output buffer as a "file" $fh = fopen('php://output', 'w'); //Create the header row fputcsv($fh, array_keys($data[0])); //Output the data foreach($data as $row) { //Add the current line to the output buffer fputcsv($fh, $row); } // Close the output buffer fclose($fh); } //Execute the functions $data = getInvoerData($_POST["IDnummer"], $_POST["Achternaam"]); csv_export($data, 'report'); exit(); ?>
-
Wait. So what IS the issue. The title suggests you want an Excel file, but the content of your post states you want a CSV file. Then you state it "works" for the most part and you are now "stuck". But, you don't state what problem you are currently facing.
-
using file_get_contents - is there a way to output progress
Psycho replied to imran0's topic in PHP Coding Help
Good call. Here's a forum post with a supposed working example: http://stackoverflow.com/questions/1939029/curl-download-progress-in-php-not-working -
using file_get_contents - is there a way to output progress
Psycho replied to imran0's topic in PHP Coding Help
This post has over 1,000 views and no one has responded. I would assume that it is not possible - at least not with file_get_contents(). You would likely have to build some process to get the size of the file, then get chunks of the file one at a time so you can calculate the percentage complete. Of course, you can't do this at all with a single PHP script. You have to implement AJAX. A PHP script completes ALL the execution and then returns the result to the page. -
@Barand, Wouldn't doing this in the query be more efficient? I always thought strtotime() was not a very speedy function. $query = "SELECT ID, firstname, DATE_FORMAT(bday, '%m-%d-%Y') as bday FROM `friend` ORDER BY bday"; $result = mysql_query($query) or die($myQuery."<br/><br/>".mysql_error()); while($row = mysql_fetch_array($result)) { $program = $row['ID']; echo "<h2>{$row['firstname']}</h2>"; echo "<h3>{$row['bday']}</h3>"; } NOte: If you don't want leading zeros on the day and month use this for the format string in the query: %c-%e-%Y
-
OK, I see you are submitting the page. But, again, why not make the name something more representative of what it actually is? If you need multiple 'likes' on the same page, make the name an array: <input type="image" src="images/arrowup.gif" name="like[]" value="<? echo $right->id; ?>"/> if(isset($_POST['like'])) { //User submitted one or more likes foreach($_POST['like'] as $likeID) { //Perform whatever operations you want based upon the ids passes $likeID = intval($likeID); } } Based upon how you would use it, the code should only ever receive a single value. But, since you would need an array to set it up, it's best to allow the code to process multiple if needed.
-
I don't understand. Why is there a ':' in the submitted value? I am assuming that the image is sending the data via an AJAX request rather than the image being a submit button. So, why not have the data sent as a single name/value pair with the name being something more obvious such as 'like'? if(isset($_POST['like'])) { $likedID = intval($_POST['like']); }
-
Assigning boolean values to non-objects display no errors?
Psycho replied to eldan88's topic in PHP Coding Help
Huh? I am not following what you are saying. That is not the "calling" of an object, that is the setting of a property for an object. Plus, you would normally use setter and getter methods for properties. You can create new Objects and Properties on-the-fly - just like when you create a variable using something like: $foo = 'bar'; You don't have to declare the object and property as you do in some languages. So, by using the wrong object name it is just creating a new object and setting that value to the property name. Turn on error reporting in strict mode and you'll see a warning. Likewise if you were using a setter method you would see an error as well. error_reporting(E_STRICT); When using the above error reporting mode, this is the type of error you would receive -
You did not read my response correctly. You don't have to use a database. The example I laid out was to use flat files for the language content - not a database.
-
php script restarts randomly with same POST data
Psycho replied to holdorfold's topic in PHP Coding Help
Give me a bit and I'll provide an improved script. This process is being made much more difficult than it needs to be. I'm assuming on the upload it also includes the email subject and the email body. -
php script restarts randomly with same POST data
Psycho replied to holdorfold's topic in PHP Coding Help
There should be no issue processing all the input in one execution unless you are processing tens of thousands of records. Then you can send the emails with whatever delays you want and would completely make the current problem moot. The problem is the script is trying to do everything in one execution. Although there are better ways to send out a lot of email than putting a delay between each one. It's your script, but the current process just seems so overly complicated to me. If/when you have problems in the future you're going to spend an inordinate amount of time trying to find/fix the problems. I'll look at a simpler solution using the example data you provided above, but what I'd really like to see is an example of what the complete set of data would be. I'm assuming you are splitting the data into packets in some way. I'd really like to see what the complete set of data looks like and know where it is coming from: are you reading it from an external file or service, uploading the file, etc. -
You don't need to convert the array. Just use the right array field in the right places when creating the query $query = "INSERT INTO table_name (id, name, email, height, width, url, is_silhouette) VALUES ('{$array['id']}', '{$array['name']}', '{$array['email']}', '{$array['picture']['data']['height']}', '{$array['picture']['data']['width']}', {$array['picture']['data']['url']}, {$array['picture']['data']['is_silhouette']})"; However, if you have data in an array, you should definitely look into prepared statements where you can pass the array to a function to do the insert. You would need to flatten the array however so the data is not is a sub-array,
-
There are many ways to implement this. I assume you will already have the translated text for everything on your site. This can be stored in "language" files or int he database. To start, I would use both a cookie and a session value to determine the user's language. When the user accesses any page on your site, Check if there is a session value for their preferred language. If so, use it and go to the next process of getting the correct content. If not, see if they have a cookie of their preferred language from a previous visit. If yes, set the session value and move to the next step. If not, provide the user a selection for the language to display or use a default. If they do make a selection, save it as both the Cookie and session value. Once you know what language to display for a user you just need a 'framework' for providing the right content. You can have completely separate content files or you can store different placeholders in flat files or the database. I would go with the latter. So, on every page, break down the content to placeholders. All pages may have some common placeholders such as title, menu items, etc. While other content is specific to the specific page. For example, an "About Us" page may have a placeholder for an extended description about your site/company, then you may have placeholders for information about key people, contact information. Store the content for those placeholders in separate 'language' files based upon the language of the content. So, one file for tamil and another for telegu. When the page loads, select the language file based upon the users selected (or default language). Then when you build the page, use the content from the language file to use in the placeholders. Example page file: <div id='welcome'><?php echo $welcome_message; ?></div> <div id='description'><?php echo $company_description; ?></div> <div id='president_label'>$pres_label; ?></div> <div id='president_name'>John Smith</div> <div id='vp_label'>$vp_label; ?></div> <div id='vp_name'>Jane Davis</div> The English language file for that page might look something like this $welcome_message = "Welcome to ABC Company's website"; $company_description = "This is a description of our company . . . "; $pres_label = "President"; $vp_label = "Vice President";
-
Hmm, what you are really asking is to explain how to work with a relational database. That's kind of a very broad topic that can't be adequately covered in a forum post. But, I'll see what I can do: First off, your terminology about linking the user to the right table and the right field seems to indicate a lack of understanding. So, let's start with the tournaments table. In addition to the tournament_name field you should have a tournament_id field that is set as the primary key and has an auto-increment integer value. You would not need to ever add/edit this value - it would be controlled by the database. The primary key is how you will reference the value. Now, you will need a second table to store the user's selections. Typically, you would have a "users" table and then use a third table to indicate which users have signed up for which tournaments. If users can sign up for multiple tournaments then you will definitely need to do this. However, if users can only sign up for one tournament you can just get away with a users table - although it is not a good practice. So, let's take the simpler second approach. When you provide the user the form, create a select list using the id of the tournaments as the value and the name as the label/text. When the user submits the form along with their personal info and the selected tournament, you would store that information into the user's table. That table will have what is called a foreign key to link it back to the selected tournament. You could name the field "tournament_id" just like you do in the tournament table (this makes it easy to identify the relationships between tables). So, your user table will now have a record for each user alone with a key so you can determine which tournament they signed up for. Now to properly use this data you will need to learn and understand how to do JOINs in your queries. Which I am not going to go into here. This is really just scratching the surface. I suggest taking some time and reading through a few tutorials.
-
You shouldn't. You should have a unique field for each piece of data. So, if you want to store the values for height, width, url & is_silhouette then you should create unique fields for each of them.
-
php script restarts randomly with same POST data
Psycho replied to holdorfold's topic in PHP Coding Help
There may be two different types of timeouts at play here. Typical "session" timeouts are set for 20 minutes. So, if you have stores information in the session it will expire if the user is inactive for 20 minutes. That is completely different from the execution timeout. That is how long a script can run before the webserver gives up. This is to prevent situations where the script may have an infinite loop. Otherwise, one bad script would bring down the server. I'm no web server guru, but I though that 300 seconds was the maximum amount that the max execution time could be set to (i.e. 10 minutes), but the default setting is much lower (maybe 30 seconds). At least that's true in Apache servers (I think). So, let's go back to what you are trying to achieve. You want to put a gap in between each email. I'm assuming to stop from it being triggered as spam? You could use a service to send the emails which would not have that limitation. Plus, why the random 2-20 second delay? Why not just set it to 1 or 2 seconds for all of them? In any event, I have a better idea to achieve what you are trying to do (although I think there is a better solution altogether). Instead of trying to send the emails when you are processing the data - separate that logic. Have the script run ONE TIME to completely process ALL the data and store it. A database would be best, but you could use a log file. That should reduce a lot of the complexity - especially around the kill switch and other triggers you had to use. Now, once you have all the processed data in a single format you can call a script with a delay that will pull N records from the repository, send the emails, and then remove those records from the repository. Then you don't have to have any logic to remember what was or was not processed! In fact you could build one script to do both the processing and the emailing. Here is a VERY basic mock example of how the framework might look <?php $dataFile = 'path/name.txt'; if(isset($_POST['value_to_determine_there_is_a_new_input'])) { //Insert logic here to process the entire input file //and create a data file with the processed results //Create file $dataFile with the processed data } else { if(file_exists($dataFile)) { //Remove a record (or records) from the data file //send the email(s) //If no more records exist in data file - delete it } else { //There are no records to process exit(); } } sleep(2); ?> -
SalientAnimal, I think you need to slow down just a tad. Get your scripts working without all the JavaScript. If you are going to go to the trouble of making things react immediately, then you should rally use AJAX rather than just dynamically submitting the page. But, don't do that until you have everything working without JavaScript. So, create your page with a simple Submit button for testing. Plus, you should use POST data as opposed to GET since you are sending so much data. This is really a simple process. On every page load you check for the selected value for any of the fields on the form. Then, query the database for the possible values and use any POSTed values to determine which options are selected when building the form fields. So, just like I provided a function to create the select list options which takes parameters for the possible values and the optional selected value, you can create similar functions for other types of form fields - such as a radio button group, checkboxes, whatever.
-
Why isn't this Regex capturing everything between the <body> tags?
Psycho replied to MySQL_Narb's topic in Regex Help
1. The content you are matching against doesn't have a closing body tag 2. You need the 's' parameter to tell the expression to traverse multiple lines - otherwise it looks for a match on single lines only The page you are using doesn't allow you to add that flag. Try a different one (e.g. http://regex101.com/) or test it yourself.