[PHP] link question

2003-10-22 Thread Davy Campano
I have a php page that makes a table from data in a mySQL database.
What I want to do is make the first entry in the table be a Unique key
that is a link, that when you click on this key it opens another page
with some more information.  Basically I am trying to figure out how to
pass this key from this page to the next.  Thanks for any help!

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



[PHP] problem transferring a variable using POST

2003-10-09 Thread Davy Campano
I am having a problem with a form.  I am trying to have a form pass a
variable so that I can update an item.  I think the problem is that the
variable (ticketed) is being read as text instead of a number.  These
are the tests I have run.  
 
This statement works:
$sql = 'UPDATE wo SET status = 1 WHERE ticket = 1'
 
This statement does not:
$sql = 'UPDATE wo SET status = 1 WHERE ticket =
$HTTP_POST_VARS[ticketed]'
 
Any suggestions...
 
If I do echo $HTTP_POST_VARS[ticketed]; 
It returns a 1


[PHP] *SOLVED* [PHP] problem transferring a variable using POST

2003-10-09 Thread Davy Campano
It worked.  Thank you very much everyone for the quick responses.  I am
just learning PHP and mySQL so I appreciate the suggestions.  I only
wish that I would have written this email an hour ago!

-Original Message-
From: Chris W. Parker [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 09, 2003 12:08 PM
To: Davy Campano; [EMAIL PROTECTED]
Subject: RE: [PHP] problem transferring a variable using POST

Davy Campano mailto:[EMAIL PROTECTED]
on Thursday, October 09, 2003 8:57 AM said:

 This statement works:
 $sql = 'UPDATE wo SET status = 1 WHERE ticket = 1'
 
 This statement does not:
 $sql = 'UPDATE wo SET status = 1 WHERE ticket =
 $HTTP_POST_VARS[ticketed]'
 
 Any suggestions...
 
 If I do echo $HTTP_POST_VARS[ticketed];
 It returns a 1

First of all you should be using $_POST and not $HTTP_POST_VARS (that is
of course if your version of php supports it).

Secondly, it's not working because (1) you are wrapping the sql
statement in single quotes which does not evaluate variables, it's a
string literal. You should change all those ' to , and (2) arrays are
treated differently than regular variables inside a string. They MUST be
wrapped with { } to be evaluated.

Third, it's a bad practice to not properly quote your array references.
In other words, the word ticketed should have single quotes around it.

Applying all these things your line should look like this:

$sql = UPDATE wo SET status = 1 WHERE ticket = {$_POST['ticketed']};


hth.
chris.

p.s. it's a Very Bad Idea(tm) to grab data directly from $_GET or $_POST
and put it to work before doing any validation on it.

p.p.s. I'm not positive about this but I'd be willing to bet that every
value gathered from $_GET or $_POST is considered a string and not
numeric. Think about it, how would $_POST know that ticketed is meant
to be an integer or a string?


-- 
Don't like reformatting your Outlook replies? Now there's relief!
http://home.in.tum.de/~jain/software/outlook-quotefix/

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



[PHP] email certain people

2003-10-09 Thread Davy Campano
I am making a webpage, and I want to be able to email certain people that are selected 
by a checkbox when I click the submit button.  I am trying to figure out what the best 
way is to do this.  There are four people on the page and they each start with their 
name checked (so they should receive an email when I click submit).  How would I go 
writing a script to check if these checkboxes are marked and then emailing each 
person???  Thanks for any help!


RE: [PHP] email certain people

2003-10-09 Thread Davy Campano
I forgot to mention that I want the email addresses to be appear on the webpage from a 
mySQL database.  I already have the emails entered into a database, and I have written 
the page that grabs each email from the database and puts it into a form with the 
Checkbox.  My problem is figuring out how to write the script to email these dynamic 
addresses.  I don't want to hard-code them into the web page.  If you need an example 
or the website, then I can send it to you so you can see.

-Original Message- 
From: Andrew Whyte [mailto:[EMAIL PROTECTED] 
Sent: Thu 10/9/2003 10:38 PM 
To: [EMAIL PROTECTED] 
Cc: 
Subject: RE: [PHP] email certain people





 -Original Message-
 From: Davy Campano [mailto:[EMAIL PROTECTED]

 I am making a webpage, and I want to be able to email certain
 people that are selected by a checkbox when I click the
 submit button.  I am trying to figure out what the best way
 is to do this.  There are four people on the page and they
 each start with their name checked (so they should receive an
 email when I click submit).  How would I go writing a script
 to check if these checkboxes are marked and then emailing
 each person???  Thanks for any help!


Davy,

Something along the lines of:

Your form items would be:

INPUT TYPE=CHECKBOX NAME=EMAIL[] VALUE=[EMAIL PROTECTED] user1 @
email.com BR
INPUT TYPE=CHECKBOX NAME=EMAIL[] VALUE=[EMAIL PROTECTED] user2 @
email.com BR
INPUT TYPE=CHECKBOX NAME=EMAIL[] VALUE=[EMAIL PROTECTED] user3 @
email.com BR

Then in PHP this get posted to, something like:

if ( is_array($_POST[EMAIL]) )
{
// Loop through each...
foreach ($_POST[EMAIL] as $key = $email_addr )
{
// send your email to each user...
}
}

This way you can simply add more email input fields to the form over
time
and the code will always work with it...

I'll leave the email sending as an exercise for the reader, there are
ample
good examples on php.net's doco about this.

Cheers, Andrew

--
Andrew WhytePh: +61 7 4930 9838
Corporate Systems Administrator Fx: +61 7 4930 9254
Information Technology Division Em: [EMAIL PROTECTED]
Central Queensland University, Rockhampton, Qld, 4702

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





[PHP] Upgrading PHP 4.1.2 to Current

2003-06-15 Thread Davy Campano
I am pretty new to Linux and I was wondering if someone can point me in the right 
direction on upgrading packages.  Right now, I am looking to upgrade PHP but actually 
I would just like to understand how to do any upgrades.  Do I have to recompile???  If 
so, how do I do this?  Thanks for any help!