Jump to content

jeffrydell

Members
  • Posts

    35
  • Joined

  • Last visited

    Never

Everything posted by jeffrydell

  1. Literally ... I'm 'losing' my arrays and I can't figgr out why. One script (we'll call it script.php for now) does 3 things (with a session initiated each time you 'hit' the script): First time in (get), I session_register() each array and set up all the needed array keys/values with " ", so they 'exist' because they'll be default values in an .html form. include('form.html'); The form's action is 'script.php?action=show' Second time in (show) it displays all the $_POST variables, adds the $_POST values to the appropriate Arrays, then displays an identical table using the arrays (so I can see that the values got transferred from $_POST to arrays properly. At the bottom of that page, there's a link to call the script a THIRD time (script.php?action=edit) - allowing the user to 'edit' the choices they made in the form. This is where we lose everything. On the third time in to the script, I can't get any values from the arrays. See it in action here: http://cjrenterprises.biz/testform.php Any ideas? I've done this type of thing MANY times before and never had trouble 'losing' arrays or variables like this. Thanks! Jeff
  2. sasa, Thank you - that works exactly as I had hoped. Jeff
  3. This is my first attempt at validating inputs to a form, please be gentle. I want to be sure that no letters are input to a field which should be a phone number. Should this work? Is there a better way? eregi('a-z', $_REQUEST['phone']) Thanks! Jeff
  4. Oddly enough, Andy - that actually makes sense. Thanks! (Gotta learn to think like a super-genius ... I'll put that on my ToDo list for next week.)
  5. That IS an option - but I don't learn how to do the character replacement by just leaving out the Password. I'm trying to learn & grow a little. The other answer is "I am curious".
  6. This seems simple enough, but I haven't found an easy answer in reading posts here or documentation on the official php site. Thanks, in advance, for your patience. I have a users table which includes username, password, and permission level. In the admin screen of the website I would like to display a table of all the users, but don't want to display the passwords on that table ... instead I'd like to just display *s for each character. So if the password was "fish", the table cell would read ****, if the password was phish, the table cell would read *****, etc. I already know about the strlen() function which can tell me the length of the password string, but what do I use to tell php to "say" * once for each character in the string?
  7. [!--quoteo(post=386944:date=Jun 22 2006, 03:48 PM:name=Wildbug)--][div class=\'quotetop\']QUOTE(Wildbug @ Jun 22 2006, 03:48 PM) [snapback]386944[/snapback][/div][div class=\'quotemain\'][!--quotec--] Here's what I see: ... Hope that's helpful. [/quote] Indeed it WAS helpful ... the function is all better now, the Northeast has been reunited with the rest of the U.S.! Thanks for your time. Jeff
  8. [!--quoteo(post=386904:date=Jun 22 2006, 01:32 PM:name=Wildbug)--][div class=\'quotetop\']QUOTE(Wildbug @ Jun 22 2006, 01:32 PM) [snapback]386904[/snapback][/div][div class=\'quotemain\'][!--quotec--] You just need to be sure that the zip code is always treated as a string throughout your code. Do you quote your zip code when searching? I.e., "00138" vs. 00138? Are you sure the zip codes have been entered into the database correctly -- strings with leading zeros? Perhaps there's an implicit type conversion occuring if you use some kind of numeric comparison (less than, greater than, etc). VARCHAR is good! [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /] Sorry, but I can't be more specific without more details of where things are going badly for your script. [/quote] Thanks for the leads. The zip contains the leading zero, I can see it if I browse the ZIPCODE table and if I browse the SUBSCRIBER table, so there's no issue with that. Here's what I'm doing: function getstate ($zip2find) { $fres = mysql_query("SELECT * FROM `zipcodes` WHERE `zipcode` LIKE $zip2find"); $frow = mysql_fetch_row($fres); RETURN $frow[2]; // State Code } // Start with an array for the subscribers and open the active subscriber table. $subscriptions = array(); $arrayrow = '0'; $res = mysql_query("SELECT * FROM `subscribers` WHERE `unregistered` IS NULL or `unregistered` LIKE '0000-00-00 00:00:00'"); // Walk through the list & add an array row for each active subscriber, which will include the state code in which they reside. while ($row = mysql_fetch_array($res)) { IF ($row['zipcode'] == "") { $subscriptions[$arrayrow] = "?"; echo "This one is a blank. <br>\n"; ++$arrayrow; } ELSE { $subscriptions[$arrayrow] = getstate($row['zipcode']); echo $row['zipcode'] . " is in the state of " . $subscriptions[$arrayrow] . " <br>\n"; ++$arrayrow; } } Do you see anything in this code? Thanks again for your help! Jeff
  9. I have a table of all US Zip Codes, and I have subscribers to my site who entered their Zip Codes when registering for a newsletter. The ZIPCODE table has a VARCHAR field for ZIP, as does the SUBSCRIBER table. All is good so far. When I try to find out how many subscribers I have in each state, everyone on the east coast gets left out ... when looking for a Zip Code that starts with a 0, the result comes back without a match. What to do so that PHP and MySQL recognize that the leading 0 should NOT be dropped? Thanks for your help!
×
×
  • 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.