Jump to content

rick2302

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by rick2302

  1. My host does not allow Mod-Rewrite, so I am stuck with www.mysite.com/index.php?topic=316I know it's better for SEO to have something like www.mysite.com/topic/316 and I think I can do that using Mod-Rewrite.So, is there any alternatives to using Mod-Rewrite, or should I look into a new host?If a new host, do you know of any that are US-based, PHP-friendly, reputable, and reasonably priced?TIA
  2. Nearly everything I know about PHP I learned from w3schools and its Forum.Please take a look at http://www.pyofun.com/ and let me know what you think.Thanks!
  3. rick2302

    Php-based Greeting

    I've used this javascript to display a greeting: function showgreeting(){ datetoday = new Date(); thehour = datetoday.getHours(); if (thehour > 16 || thehour < 3) display = "Evening"; else if (thehour > 11) display = "Afternoon"; else display = "Morning"; var greeting = ("Good " + display + "!"); document.write(greeting);} HTH
  4. rick2302

    Session Variables

    I am developing a website that uses Session Variables. They work fine on my Development Machine, I can set them, and display them, but when I attempt to use the website on another Computer in my Home Network, they do not work - no values can be set or retrieved.The URL on my Development Machine is http://localhost/index.php and my other computer is http://<developmentMachineName>/index.phpI seem to think it has something to do with my php.ini file and maybe I need to set something with ini_set but I cannot seem to figure it out.I expect this will be a problem once I publish the site to my host, so am trying to get a handle on it sooner than later.Any ideas??Thanks!
  5. rick2302

    Debug Help Code

    To gain a view to what is going on when debugging, I set up this function which logs a string to a text file.It appends the string to an existing file or creates a new file if there is no file for that day: function logString($_StringToLog){ $_fileName = date("Y-m-d") ."_log.txt"; $_timeStamp = date("h:i:s A"); $_sourceFile = $_SERVER['PHP_SELF']; $_CR = chr(10); $file = fopen($_fileName,"a"); fwrite($file,$_CR .$_timeStamp ." - " .$_sourceFile ." - " .$_StringToLog); fclose($file);} It's called by a lines like: logString("Got to CheckName function");logString("Insert query: " .$query_insert); I have found this immensely helpful and figured someone else would too.Enjoy!
  6. confirmDataLoss() is mine - I can return any value - it's just that I am not sure how I would be able to use anything other than true/false. I'd have to incorporate an If statement somewhere to see the return value, then decide how to proceed - not sure that would be done.For now I removed the part of the .js include file (not mine - but I can edit it) that was fooling my validator script - from what I can see, it will not reduce any noticable functionality - may just remove a convenience item - no big loss.
  7. OK - I found the problem. The included .js file has a "return true" that is faking out my validator.I really kinda need this .js file, so as a workaround, is there a way that I can validate and return something other than true or false, like "valid" or "invalid", that I can use instead? I think I know how to return the value, but am not sure how to check to see what I got back.Any ideas??
  8. I decided to remove everything from the page piece by piece to try to track this down. It turns out that a new .js include is messing things up. So I think I am all set now; the code works without that .js include file. Now I just need to find out why.... but I am on my own for that...Thanks!
  9. I check my form for changes, and if there are any, my validator returns false, else, true. Trouble is, regardless of the return value, the form is always submitted (it just navigates to another page). <form name="returnMainMenuform" action="administration.php" method="post"> <input type="submit" class="buttonStd2" name="cancel" value="Main Menu" onclick="return confirmDataLoss()" /></form> the code below DOES work, but I'd rather not do it this way, due to some other controls on the page: <form name="returnMainMenuform" action="administration.php" method="post" onsubmit="return confirmDataLoss()"> <input type="submit" class="buttonStd2" name="cancel" value="Main Menu" /></form> Is there a way to get the first example to work?Thanks!
  10. I have seen $_POST["userName"] and {$_POST["userName"]} but am not sure what the curly braces do.
  11. I have PHP writing the HTML so just before the </body> added this:echo ' <script type="text/javascript"> window.location="file://MenuShare/ShowMenu.bat"; </script>';and it works fine, launching the Batch file that in turn launches the Executable.I found that trying to launch the Executable directly caused two prompts to "Run", whereas using the Batch file only prompts once. That is still one too many (would rather zero interaction from the user), but at least the user does not have to launch the executable themselves, just needs to acknowledge the "Run".Thanks for the suggestions!!
  12. Am trying to use PHP to launch an Executable file on the Server.The server is on a local network, not the web, so we're not worried about permissions or anything.Have been trying fopen() with no luck.A hyperlink works fine, but we'd rather the user not have to click anything. Once the page loads, the executable should launch.
  13. Got it.File name of code below = rickTest.php: <?php$_nameis = $_POST['name'];$_ageis = $_POST['age'];$_activities = $_POST['activities'];echo "name = " .$_nameis;echo "<br />";echo "age = " .$_ageis;echo "<br />";echo "activities = " .$_activities;echo "<br />";echo "activities0 = " .$_activities[0];echo "<br />";echo "activities1 = " .$_activities[1];echo "<br />";echo "activities2 = " .$_activities[2];?><form action="rickTest.php" method="post">Enter your name: <input type="text" name="name" /><br />Enter your age: <input type="text" name="age" /><br />MultiSelect:<select name="activities[]" size="5" multiple><option value="noPref">No Preference</option><option value="amuse">Amusements</option><option value="animal">Animal Attractions</option><option value="art">Art, Music & Theater</option><option value="burial">Burial Grounds & Monuments</option><option value="ed">Education & Research</option><option value="hist">Historic Sites</option></select><input type="submit" /></form> Hope this is helpful to others!
  14. I am relatively new to PHP and have been working with using forms and can handle the basics. What I would like to do is have a list box on a form that enables multiple selections:<select name="activities" size="4" multiple><option value="0">No Preference</option><option value="1">Amusements</option><option value="2">Animal Attractions</option><option value="3">Art, Music & Theater</option><option value="4">Burial Grounds & Monuments</option><option value="5">Education & Research</option><option value="6">Historic Sites</option></select>I cannot seem to figure out a way to hand off the selection(s) to PHP. If the user selects one, no problem, if they select more than one, I am stuck - only one value comes across.Thanks!
×
×
  • Create New...