Jump to content

foochuck

Members
  • Posts

    82
  • Joined

  • Last visited

    Never

Everything posted by foochuck

  1. One more question, could I just do this? $myVariable = 'may the force be with you'; if(strpos($myVariable, 'the force') === true) { //It was found.. }
  2. Thanks Alex. One more question - could you show me how I could turn this into a function so I can feed two variables into strpos and then return a string of HTML if the string IS found...?
  3. I'm trying to figure out how to search through a variable for a given string. For example my variable is: $myVariable = 'may the force be with you'; I want to search through the variable to see if it contains 'the force'. Is there a function to do this? Thanks
  4. Good point mj. Thanks again. Javascript IS a great way to give the user immediate feedback, however it should NOT be relied upon as the only validation. You must ALWAYS have server-side validation. User can have JS turned off or submit data without using your form.
  5. I have a basic text input field on a web form. I want to have my users type in 16 numbers ( it can be any sixteen numbers - as long as the count is 16 numbers exactly - I'm not checking it with a database ) Using a post method, the page submits the form to itself. Basically, I'm just wondering how I can tell if 16 numbers have been entered into my field? The field is named fm_id. I'm taking it from the $_POST and creating a variable called $id How can I count the number of numbers in $id ? Thanks FOO
  6. I've created a simple login form on my website - it has a field for a phone number, username and password like so: <form action=self.php METHOD=POST> <fieldset> <legend>Welcome to On-Line Ordering</legend> Enter your phone number: <INPUT TYPE="text" NAME="WIPHNARA" SIZE=3 MAXLENGTH=3 Value='' > <INPUT TYPE="text" NAME="WIPHNNBRPRE" SIZE=3 MAXLENGTH=3 Value='' > <INPUT TYPE="text" NAME="WIPHNNBRSUF" SIZE=4 MAXLENGTH=4 Value='' > <BR><BR>Enter your email address: <INPUT TYPE="TEXT" NAME="WIEMAIL" SIZE=60 MAXLENGTH=60 Value='' > <BR><BR>Enter your password: <INPUT TYPE="PASSWORD" NAME="WICUSTNO" SIZE=6 MAXLENGTH=6 Value='' > <BR><BR><BR><INPUT TYPE="submit" VALUE="Request Authorization" NAME="WIBUTTON"> </fieldset> </form> Is there a way to make the form retain the phone, username & password info so the people don't have to retype it everytime they come back to my website? Foo
  7. Samshel - do I define the CFG_ROOT constant in my website homepage? Or does it not matter where I define this? Also is this correct for my directory structure? : define("CFG_ROOT", "/www.mysite.com/"); FYI - when I connect to my server through FTP /www.mysite/ is the highest folder I can access.
  8. I've been using the include function on my website. However, I recently started making some sub-folders on my site and any pages in those folders aren't pointing to the correct include file. /mysite.com/includes/functions.php <?php include("includes/functions.php"); ?> So that's the code I'm using on all of my pages through a template. I've tried an absolute path the the include function but it doesn't work. I've tried looking up several work arounds for this but haven't been able to get it to work on my site. Could someone show me how to make the include be an absolute path to the file so it works throughout every directory of my website? Thanks FOO
  9. The code I'm using already has $data = explode(",", trim($item['data'])); throughout... I don't want to break the code using split...
  10. I'm using the explode function... $pizza = "piece1,piece2,piece3,piece4,piece5,piece6"; $pieces = explode(",", $pizza); echo $pieces[0]; // piece1 I would like to include an actual comma "," in the pizza variable and have it appear in the string. For example I want: "piece,1,piece,2,piece,3,piece,4,piece,5,piece,6"; This isn't the real working sample. Anyway, my main question is how do I escape the actual commas so they are kept in the strings and distinguished from the delimiter commas??? Thanks FOO
  11. Thanks...That's what I was looking for...FYI I mistyped and didn't have $ in those variable names...
  12. DarkWater, One more question - is there any way to interpolate a variable name into my session variable? For instance, I'm creating several SESSION variables. They are named: $_SESSION['$aInfo'] = "This is only a test"; $_SESSION['$bInfo'] = "Another Test"; $_SESSION['$cInfo'] = "Yet another"; From there I'm passing a variable from one page to another... I pass $folder $folder = "a"; On the next page I want to interpolate the $folder variable into my SESSION variable name somehow like so: $_SESSION['$folderInfo']; That doesn't work and neither does... $_SESSION[' . $folder . Info']; or $_SESSION[' . "$folder" . Info']; I'm probably using the incorrect syntax. I have tested this on my page and I can verify that the session is working correctly echo $_SESSION['aInfo']; // reads "This is only a test" But I want to put $folder in place of a since I'm passing other variables through a URL. Can you show me the correct syntax for passing $folder into the SESSION variable name?
  13. Thanks for all your help on this one DarkWater.
  14. I'm not really sure what the advantage of POST over SESSIONS would be...or vice versa.
  15. Thanks DarkWater. One final question about your example for page 1: session_start(); $_SESSION['somevar'] = $yourLongVariable; Can I set $yourLongVariable on the same line where I'm copying it into $_SESSION['somevar'] ? Like this... session_start(); $_SESSION['somevar'] = $yourLongVariable = "abcdefghijklmnopqrstuvwxyz"; or should I do this... session_start(); $yourLongVariable = "abcdefghijklmnopqrstuvwxyz"; $_SESSION['somevar'] = $yourLongVariable;
  16. You left out ' ' around var...do I need those or not? $_SESSION[var]
  17. DarkWater, Using the sample below from the tutorial...could you show me an example of how to set my very long variable and call it using Sessions? <?php session_start(); $visits = $_SESSION['visits']++; if ($visits == 0) { echo 'I have never seen you before, but I am glad you are here '; } else { echo 'Welcome back! You have been here ', $visits, ' time(s) before'; } ?>
  18. I'll give that a try. Know of any good tutorials on PHP sessions?
  19. I have a very long variable (over 250 characters) that I don't want to pass from one page to another. I don't want this variable shown in the URL either. I'm guessing I'll have to use $_POST but I'm not sure how to pass this variable from one page to another without using it in a URL. Could someone show me a sample of how to do this. Let's just say my variable is: $alphabet="abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890"; FOO
  20. Thanks for everyone's help with this topic. The problem was that I wasn't using the a tag / url in an echo function. FOO
  21. I'm using a basic click URL method to pass the variable to the next page... <a href="http://www.thewebsite.com/projects.php?masterVar=var1">My Link</a>
  22. Page 1: $var1 = "This is my text"; http://www.thewebsite.com/projects.php?masterVar=var1 Project.php Page: $masterVar = $_GET["masterVar"]; echo "$masterVar"; // This reads $var1 - I'd like it to read This is my text
×
×
  • 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.