[PHP] newbie: hmtl form to select items from mysql db

2004-01-15 Thread Danny Anderson
Hola, PHP folk!

I am slowly getting a handle on what php/mysql can do.  I have a mysql 
database that I can display in a web browswer with php.  That part is 
working just fine, but it was the easiest part, of course.

My goal is to create an order form sort of thing were a certain quantity 
of each item is specified, and the final step is creating the invoice 
with the grand total is tabulated, etc, etc.  I know this is standard 
stuff, my immediate question is more specific.

I need some direction in creating the html form where the items are 
selected.  As it stands now, I have six digit ID numbers that identify 
each item.  The first digit represents the general class of items and 
the second digit represents a sub-class.  The remaining four are arbitrary.

What I would like is for the user to
1)pick the class, see the available sub-classes
2)pick the subclass, see the items available
3)pick the item
4)pick quantity
If anybody can point me to a tutorial or examples, I would be most 
appreciative.

Danny

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


[PHP] 4.2.2 doesn't have mysql_real_esacpe_string()

2003-12-31 Thread Danny Anderson
Hola, PHP folk!

I am learning about PHP from a book (MySQL/PHP Database Applications). 
I have been following the examples in the book, modifying them to suit 
my purpose and experiment, etc.
I am using an old work machine my webserver.  I did a Redhat 9 install, 
adding MySQL version 4.  The 'stock' Redhat installation of PHP was 
version 4.2.2.  Having this older version had presented no problems 
until now.  The example I am currently working on uses a function 
mysql_real_escape_string(), which is only in php 4.3.0 and higher.  An 
example of the how the function is used:

[code]
$query = sprintf($query
, mysql_real_escape_string($name)
, mysql_real_escape_string($location)
, mysql_real_escape_string($email)
, mysql_real_escape_string($url)
, mysql_real_escape_string($comments)
, mysql_real_escape_string($_SERVER['REMOTE_ADDR'])
);
safe_mysql_query($query);
[/code]
I am looking for recommendations on what I should do.  I can upgrade to 
the latest version of PHP if need be, though I am not particulary eager 
to do so, since everything else has been playing nice with each other.

The lazy person inside of me is looking for a painless answer, something 
 along the lines of just use mysql_foo() instead, it does the same 
thing as that function that isn't in 4.2.2

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


[PHP] best way to specify path to a file in a $variable?

2003-12-30 Thread Danny Anderson
Hola, PHP folk-

I am using

$page_title=some page title here;
require('header.inc');
to include a common header for all my pages.  I am using $page_title so 
I can have unique names for the different pages.

//---header.inc
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
html
  head
title?php echo $page_title; ?/title
link rel=stylesheet href=./some.css type=text/css
  /head
body
...


I want to be able to also define the path to the CSS file.  For 
instance, some pages will have the CSS in the same directory, so that 
part would read

./my.css

If the page is located in a subdirectory, the path would then be

../my.css

I would like to use a php variable where I can define the path the same 
way as the $page_title works.  I have tried some experiments with a 
$path_to_css variable, but I have not had much success.  I think part of 
the problem is that I might be stumbling over escaping everything properly.

Is there a better way to do what I am trying to do?

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


[PHP] Apache 2.0.48 won't play nice with php 4.3.4 ?

2003-12-22 Thread Danny Anderson
Hola, PHP folk!

I hope this is an appropriate forum for this:

I am setting up a Redhat 9 webserver to serve as my testbed for a little 
php/mysql app I want to develop.  I installed RH9 without the 
webserver/php/mysql so I could manually install the most current versions.
MySQL 4.0.16 installed fine, Apache (httpd-2.0.48) installed fine.  PHP 
4.3.4 seemed to install fine.  Unfortunately, when I try to start the 
webserver with php, I get the following error:
'...httpd: module 
/usr/local/php-4.3.4/sapi/apache2handlers/sapi_apache2.c is not 
compatible with this version of Apache.

Help!  Is there a work around for this?  Apache will start fine if I 
don't try to enable php via LoadModule in the Apache configuration file.

Any comments and suggestions appreciated.

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