[PHP] Re: Defaults in drop down list...

2003-01-07 Thread Guy Haynes
Here is another option for you to sample.

The function takes two parameters, one is the name of the list box, the 
other is the value to be initally selected. The second parameter is 
optional, if not present, no value will be inially selected. I do not 
remember where I picked this up, but I have used it many times.

---
function MakeStateDropMenu($Name,$Selected=""){

$StateDropMenu=<<

  Alabama
  Alaska
  Arizona


StateDropMenu;
if ($Selected){
  $StateDropMenu = preg_replace("|\"$Selected\">*|","\"$Selected\" 
selected>",$StateDropMenu);
}
return $StateDropMenu;
}
---
To call function from page:

 echo MakeStateDropMenu("states","$selectedstate");
?>

Guy Haynes


Steven Kallstrom wrote:
I have a drop down list with all fifty states. very common.  I conjured
up a way to store the value when you return to edit the form, but there
most be an easier way either in html, or in php.  Here is what I
currently have.
 

Alabama
Alaska
Arizona
.

 
$stateselected['$state'] is an array that stores the state that was
selected on the prior form.  is there an easier way, to have a default
state picked out of this drop down list.???
 
Thanks,
 
Steven Kallstrom



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: A PHP page counter / statistics app

2003-02-28 Thread Guy Haynes
Take a look here http://www.unf.edu/~hayg0001/php/pagetracker.php. I 
have a script that you can use as a starting point. It is nothing fancy, 
but it works. Every thing is stored in a database, where I can then 
produce real time reports for the site.

~Guy Haynes

Michael Zornek wrote:
I'm ether looking to find or build my own open source php based script, that
would allow you to include a small code chunk on every page of a site and
then view statistics from the info, on what pages were viewed, how many
times, etc...
First, if there are any you know of and want to recommend, please post.

Secondly, if I do build it myself would it be better to write this log to
file or mysql db? Right now I only get like 200 page views a day but still
am concerned about resource use since I'm on a shared server.
Finally, can you call a php script from an ServerSideInclude page??

~ Mike


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php