[PHP-DB] Re: Need help with delete and modify functions on a form.

2005-10-18 Thread Arie Nugraha
Checkbox form element is easy to applied in php

if you have a script like this :

form
input type=checkbox name=check1 value=someValuenbsp;Some Value
/form

Then to get the value of checkbox you can do this :

?php
// print the value of checkbox
echo $_POST[check1];
?

You can also use an array :

form
input type=checkbox name=check[] value=someValue1nbsp;Some Value 1
input type=checkbox name=check[] value=someValue2nbsp;Some Value 2
input type=checkbox name=check[] value=someValue3nbsp;Some Value 3
/form

to get the the third value from the form you can do like this :

?php
echo $_POST[check][2];
?

Hope that will help

On 10/17/05, Juan Stiller [EMAIL PROTECTED] wrote:

  --- Bastien Koert [EMAIL PROTECTED] escribió:

  something like this example
  (http://www.weberdev.com/get_example-4085.html)?
 
  Bastien
 

 Thanks Bastien, that would do the job, ill study it to
 adapt it to my needs.

 Another thing, i have some flash buttons, (im ussing
 dreamweaver), so once the records are displayed, user
 can filter the info lets say choosing the lastname
 filed, as its a precompiled button i only can specify
 a link.

 I saw once that with php you can specify pure code on
 the link funcion is there any chance to specify in the
 link section the filter code? like:

 SELECT * from mydatabase where lastname = 'john'???

 i think it was a way but i can´t find it now??

 Also, do you have any experience with checkbox on a
 form, i mean some tut??

 Thanks.

 Juan.


   


   
   
 ___
 1GB gratis, Antivirus y Antispam
 Correo Yahoo!, el mejor correo web del mundo
 http://correo.yahoo.com.ar

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



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



RE: [PHP-DB] Re: Need help with delete and modify functions on a form.

2005-10-18 Thread Norland, Martin
-Original Message-
From: Arie Nugraha [mailto:[EMAIL PROTECTED] 

You can also use an array :

form
input type=checkbox name=check[] value=someValue1nbsp;Some
Value 1
input type=checkbox name=check[] value=someValue2nbsp;Some
Value 2
input type=checkbox name=check[] value=someValue3nbsp;Some
Value 3
/form

to get the the third value from the form you can do like this :

?php
echo $_POST[check][2];
?

Good basic examples, two notes though -
1) form method=post (blindingly obvious to most, but might confuse
some)
2) the name/value pair will only be POSTed if it's checked, so that
would only work if the first two were checked.

Some people like to pair all their checkboxes with a hidden of the same
name, the hiddens value will be sent if the checkbox isn't checked.
Personally, I prefer having an actual unique name for the checkbox when
you need to check a specific one.  If you don't need to check if 'the
third one' is set, but you're just getting - for e.g. - a list of pizza
toppings, then the order doesn't matter and [] works fine.  Otherwise
(if it does), give it a unique name:
input type=checkbox name=check[0] value=someValue1nbsp;Some
Value 1
input type=checkbox name=check[1] value=someValue2nbsp;Some
Value 2
input type=checkbox name=check[2] value=someValue3nbsp;Some
Value 3

(although a little more unique would be clearer :) )

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

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



RE: [PHP-DB] Re: Need help with delete and modify functions on a form.

2005-10-18 Thread Linda H



?php
echo $_POST[check][2];
?

2) the name/value pair will only be POSTed if it's checked, so that
would only work if the first two were checked.

Some people like to pair all their checkboxes with a hidden of the same
name, the hiddens value will be sent if the checkbox isn't checked.


The following method worked well for me using the ternary conditional 
operator (?:):


$step = (isset($_POST['step'])) ? $_POST['step'] : NULL;

isset checks to see if a field named 'step' was received thru a POST 
operation. The statement creates a variable named $step. If the field 
'step' was passed, it sets $step to it's value. If the field 'step' was not 
passed, it sets $step to NULL (you could set it to anything you wanted).


Be sure you keep it straight whether the field you are looking for was 
passed by a POST or a GET. If the field is appended on the URL, use 
$_GET['fieldname']. It is possible to receive formfields through a POST 
operation and fields on the URL (use GET) at the same time.


LInda Hobbet 


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