Re: [PHP] Passing var from one page to itself
Hi there, Thanks so much everyone I really appreciate the help! I have it working now using hidden tags from each page to the next. www.adslgeek.com/troubleshooter Merry Christmas! Cheers Aslan tedd wrote: At 4:10 PM +1300 12/21/08, Aslan wrote: Hey there, I have a problem where I have a simple -script that I am wanting to pass back to itself three times 1) Symptoms - 2) Troubleshooting questions 3) Answer to problem -snip- I have it currently all on one page, but it isn't quite what I was after .. Any help would be appreciated! Hi Aslan: Keeping it all on one page (one script) is fine -- no problems with that. Here's the technique I use. $step = isset($__POST ['step']) ? $__POST ['step'] :1; if($step == 1) { // do the first page stuff (Symptoms) // with a POST form that has an input type=hidden name=step value=1 } if($step == 2) { // do the second page stuff ( Troubleshooting questions) // with a POST form that has an input type=hidden name=step value=2 } if($step == 3) { // do the third page stuff (Answer to problem) // with a POST form that has an input type=hidden name=step value=3 } If you want to pass variables between pages (trips from client to the server nad back again), you have four options, namely: 1) writing/reading a file; 2) writing/reading a database entry; 3) passing via a POST/GET; 4) or using SESSIONS. For most things, I prefer using POST/GET and/or SESSIONS. Try this format: $var1 = isset($_POST['var1']) ? $_POST['var1'] : null; $var2 = isset($_SESSION['var2']) ? $_SESSION['var2'] : null; That's the way I pass data between client and server. However, what you are describing sounds a bit like this: http://webbytedd.com/b/exam/ With this example, I'm not passing anything to the server -- everything is kept client-side and is quick. If interested, all the code is there. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing var from one page to itself
Hey there, I have a problem where I have a simple -script that I am wanting to pass back to itself three times 1) Symptoms - 2) Troubleshooting questions 3) Answer to problem The page is passing the vars from the first page to the second, but the first pages vars are not passed to the third (but the second page is) I am using includes for each sectional page and passing it back to itself if($submitted == ) { include 'inc/tshoot2-input.php'; } if($submitted == symptoms) { include 'inc/tshoot2-symptoms.php'; } if($submitted == submitted) { include 'inc/answers.php'; } The tool will ultimately be on www.adslgeek.com/troubleshooter/ I have it currently all on one page, but it isn't quite what I was after .. Any help would be appreciated! Cheers ADSL Geek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Questions about finding ranges
You guys are just awesome! Thanks already for the help I really appreciate it! My site is up on adslgeek.com/troubleshooter but I have a DNS problem that I have to fix over the weekend. :-( The scenario is an input dashboard, with various settings that measure the quality of an ADSL line. I have then mapped out all of the possible faults that I could think of that might fit those settings(did up a flowchart of questions that is huge). So for simplicity say the inputs are: - X Noise on line - X Distance from exchange - X Disconnections per day - Slow speed of x Then I have a list of all the possible scenarios eg 1) Disconnections caused by noisy line 2) Disconnections caused by distance 3) Slow due to noisey line 4) Slow due to distance So how I have currently done this is heaps of nested if statements, but that is going to get so unmanageable, and the speed is going to become a factor. What I had envisioned was input all the possible vars, and then SQL just finds the closest variable. It is kind of similar in logic to a search engine type script - if I had the strings disconnections and noisey of 52 then it just finds the closest record. Does that make sense? Thanks heaps you guys have been so helpful. Cheers, Aslan Micah Gersten wrote: Here's the info on the weirdness of between: http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#operator_between Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com VamVan wrote: Hey, For ranges you can also use Between in the mysql queries. SELECT * FROM table WHERE Type= Attainable AND Min LIKE $var can be written as Select * from table where between min and max Just remember that between acts a bit wierd with dates or else Jim's solution would be perfect for you. Thanks On Wed, Jul 23, 2008 at 7:58 AM, Jim Lucas [EMAIL PROTECTED] wrote: Aslan wrote: Hey there, I have a range of records that represent different faults and different symptoms that I want to pull out of the database, and to find the records that are the closest within each range. I am currently doing it with a barrage of if statements, but I am sure that this could be done faster and far more elegantly by using SQL I have a range of conditions eg Attainable rates: 0-500 KB/sec is very poor 500 - 1000 is marginal 1000- 3000 KB/sec is good So the database may look like: Type|Min|Max|Value Attainable|0|500| This rate is very poor and then SQL could go something like SELECT * FROM table WHERE Type= Attainable AND Min LIKE $var You're close, try this SELECT * FROM table WHEREType = Attainable ANDMin = $var ANDMax = $var as long as your min and max do not overlap from row to row, you should only get one result. Make sure in your data that you have no overlap. Row 1 =0 - 499 Row 2 = 500 - 999 Row 3 = 1000 - 1499 But that wouldn't work quite right I don't think. But where it can get a bit more hairy is that I want to have a whole range of variables that are input from an entry table, and then it just finds the the vars that are the closest to what is searching for all the vars. The closest code I have seen doing something similar is where there it is finding if an IP is in a certain range. Does that make sense? feel free to email me if you need more explanation. It is kind of like a multi variable search engine, that is finding the root cause of the symptoms that are the very best fit given the multi-variables... Thanks heaps for any assistance, Aslan. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Questions about finding ranges
Hey there, I have a range of records that represent different faults and different symptoms that I want to pull out of the database, and to find the records that are the closest within each range. I am currently doing it with a barrage of if statements, but I am sure that this could be done faster and far more elegantly by using SQL I have a range of conditions eg Attainable rates: 0-500 KB/sec is very poor 500 - 1000 is marginal 1000- 3000 KB/sec is good So the database may look like: Type|Min|Max|Value Attainable|0|500| This rate is very poor and then SQL could go something like SELECT * FROM table WHERE Type= Attainable AND Min LIKE $var But that wouldn't work quite right I don't think. But where it can get a bit more hairy is that I want to have a whole range of variables that are input from an entry table, and then it just finds the the vars that are the closest to what is searching for all the vars. The closest code I have seen doing something similar is where there it is finding if an IP is in a certain range. Does that make sense? feel free to email me if you need more explanation. It is kind of like a multi variable search engine, that is finding the root cause of the symptoms that are the very best fit given the multi-variables... Thanks heaps for any assistance, Aslan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php