php-windows Digest 10 Jul 2003 20:15:50 -0000 Issue 1819
Topics (messages 20758 through 20769):
mssql
20758 by: Alain ROMERO
20759 by: Miha Nedok
checkboxes in php
20760 by: Harpreet
20761 by: Stephen March
20762 by: Luis Moreira
20763 by: Luis Moreira
20764 by: Charles P. Killmer
20766 by: Charles P. Killmer
need help with sessions
20765 by: Donatas
20767 by: Luis Ferro
20768 by: Donatas
df
20769 by: Sheldon Quinton
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Where is mssql.dll (not include in packages 4.1.2 / 4.2.3 / 4.3.2 ?
Thanks
--- End Message ---
--- Begin Message ---
You have to install the client libraries from the MSSQL setup CD.
-Mike
On Thu, 10 Jul 2003, Alain ROMERO wrote:
> Date: Thu, 10 Jul 2003 14:06:20 +0200
> From: Alain ROMERO <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] mssql
>
> Where is mssql.dll (not include in packages 4.1.2 / 4.2.3 / 4.3.2 ?
>
> Thanks
>
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
I have 4 checkboxes in a form. I can select any number of boxes.When i go to
the results page it gives me errors for boxes i dont select
Notice: Undefined index: toall in e:\INetPub... on line 27
Please help
Regards,
Harpreet
--- End Message ---
--- Begin Message ---
Could you please post your code? It's a lot easier to find the
problem .... ie: what is line 27 trying to do?
Cheers,
~Steve
Harpreet wrote:
I have 4 checkboxes in a form. I can select any number of boxes.When i go to
the results page it gives me errors for boxes i dont select
Notice: Undefined index: toall in e:\INetPub... on line 27
Please help
Regards,
Harpreet
--- End Message ---
--- Begin Message ---
PHP passes variables it initalizes, not all.
You should check if the variable is set with the "isset" function.
Anyway, if you want. post your code, and I'll take a look at "line 27", wich
should be referring to an "array element" corresponding to a non-selected
checkbox.
Luis
----- Original Message -----
From: "Harpreet" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 2:12 PM
Subject: [PHP-WIN] checkboxes in php
> I have 4 checkboxes in a form. I can select any number of boxes.When i go
to
> the results page it gives me errors for boxes i dont select
> Notice: Undefined index: toall in e:\INetPub... on line 27
>
> Please help
> Regards,
> Harpreet
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Take this for an example :
This script fills part of a form with checkboxes named C1,C2, ect
$cnt=0;
for ($i=1;$i<=$n_alunos;$i++) {
if ($cnt==0) {
print "<tr>";
}
print "<td><input type=\"checkbox\" name=\"C$i\" value=\"on\">Aluno
$i</td>";
$cnt++;
if ($cnt==$colunas) {
print "</tr>";
$cnt=0;
}
}
This script receives the result from the previous form, and checks wether
checkbox C2 is set or not
if (!empty($_POST['C2'])) {
$b = $_POST['C2'];
}
else {
$b = "vazio";
}
An example ...
----- Original Message -----
From: "Harpreet" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 2:12 PM
Subject: [PHP-WIN] checkboxes in php
> I have 4 checkboxes in a form. I can select any number of boxes.When i go
to
> the results page it gives me errors for boxes i dont select
> Notice: Undefined index: toall in e:\INetPub... on line 27
>
> Please help
> Regards,
> Harpreet
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--- End Message ---
--- Begin Message ---
Try this
<?
$i = 0;
echo '<form>';
echo '<input type="checkbox" name="temp['.$i++.']" value="3124">';
echo '<input type="checkbox" name="temp['.$i++.']" value="6345">';
echo '<input type="checkbox" name="temp['.$i++.']" value="456243">';
echo '<input type="checkbox" name="temp['.$i++.']" value="45">';
echo '<input type="checkbox" name="temp['.$i++.']" value="6756">';
echo '<input type="checkbox" name="temp['.$i++.']" value="4567">';
echo '<input type="submit" name="submit" value="test">';
echo '</form>';
//Then in PHP whether the box is checked or not your indexes are
correct.
print_r($temp);
?>
Charles Killmer
Netgain Technology
-----Original Message-----
From: Luis Moreira [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 10, 2003 8:38 AM
To: Harpreet
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] checkboxes in php
Take this for an example :
This script fills part of a form with checkboxes named C1,C2, ect
$cnt=0;
for ($i=1;$i<=$n_alunos;$i++) {
if ($cnt==0) {
print "<tr>";
}
print "<td><input type=\"checkbox\" name=\"C$i\" value=\"on\">Aluno
$i</td>";
$cnt++;
if ($cnt==$colunas) {
print "</tr>";
$cnt=0;
}
}
This script receives the result from the previous form, and checks
wether checkbox C2 is set or not
if (!empty($_POST['C2'])) {
$b = $_POST['C2'];
}
else {
$b = "vazio";
}
An example ...
----- Original Message -----
From: "Harpreet" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 2:12 PM
Subject: [PHP-WIN] checkboxes in php
> I have 4 checkboxes in a form. I can select any number of boxes.When i
> go
to
> the results page it gives me errors for boxes i dont select
> Notice: Undefined index: toall in e:\INetPub... on line 27
>
> Please help
> Regards,
> Harpreet
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
<input type="checkbox" name="temp[0]" value="2352">
<input type="checkbox" name="temp[1]" value="47856">
<input type="checkbox" name="temp[2]" value="478">
When submitted this will create an array in PHP.
This is the output of a test run
Array
(
[0] => 3124
[3] => 45
[4] => 6756
)
Notice the indexes.
while (list ($key, $val) = each ($temp)) {
echo "$key => $val<br />\n";
}
Charles
-----Original Message-----
From: Luis Moreira [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 10, 2003 9:31 AM
To: Charles P. Killmer
Subject: Re: [PHP-WIN] checkboxes in php
Must be whitout coffee, but don't see the point.
The passing of check boxes comes from the fact of selecting them or not.
I tried to insert your code and got nowere. How do you see if in between
those boxes, one in the middle is set ?
----- Original Message -----
From: "Charles P. Killmer" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 3:12 PM
Subject: RE: [PHP-WIN] checkboxes in php
Try this
<?
$i = 0;
echo '<form>';
echo '<input type="checkbox" name="temp['.$i++.']" value="3124">';
echo '<input type="checkbox" name="temp['.$i++.']" value="6345">';
echo '<input type="checkbox" name="temp['.$i++.']" value="456243">';
echo '<input type="checkbox" name="temp['.$i++.']" value="45">';
echo '<input type="checkbox" name="temp['.$i++.']" value="6756">';
echo '<input type="checkbox" name="temp['.$i++.']" value="4567">';
echo '<input type="submit" name="submit" value="test">';
echo '</form>';
//Then in PHP whether the box is checked or not your indexes are
correct.
print_r($temp);
?>
Charles Killmer
Netgain Technology
-----Original Message-----
From: Luis Moreira [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 10, 2003 8:38 AM
To: Harpreet
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] checkboxes in php
Take this for an example :
This script fills part of a form with checkboxes named C1,C2, ect
$cnt=0;
for ($i=1;$i<=$n_alunos;$i++) {
if ($cnt==0) {
print "<tr>";
}
print "<td><input type=\"checkbox\" name=\"C$i\" value=\"on\">Aluno
$i</td>";
$cnt++;
if ($cnt==$colunas) {
print "</tr>";
$cnt=0;
}
}
This script receives the result from the previous form, and checks
wether checkbox C2 is set or not
if (!empty($_POST['C2'])) {
$b = $_POST['C2'];
}
else {
$b = "vazio";
}
An example ...
----- Original Message -----
From: "Harpreet" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 10, 2003 2:12 PM
Subject: [PHP-WIN] checkboxes in php
> I have 4 checkboxes in a form. I can select any number of boxes.When i
> go
to
> the results page it gives me errors for boxes i dont select
> Notice: Undefined index: toall in e:\INetPub... on line 27
>
> Please help
> Regards,
> Harpreet
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
First some data about my setup:
PHP 4.2.3 (I bet nothing has changed till PHP 4.3.2 regarding
sessions) running on Windows 2K server
My PC:
Windows 98 SE
Browser:
IE 6.0.2600.0000
Now, the problem occurs when using sessions and header
('Location: ...');
test1.php
/**********************/
<?
session_save_path ('c:/winnt/temp/'); //making sure that the path
is correct, I override any value set in php.ini
session_start ();
$_SESSION ['someVar'] = 'Hello';
session_write_close (); //saving session data and closing it
header ("Location: http://hqserver/....../test2.php");
//echo '<a href="http://hqserver/....../test2.php">To
test2.php</a>';
?>
test2.php
/**********************/
<?
session_save_path ('c:/winnt/temp/');
session_start ();
var_dump ($_SESSION);
?>
So, when I first open browser and go to test1.php I get redirected to
test2.php and see this output:
array(0) { }
When I edit the link in IE linkfield from test2.php (rememeber..
there was a redirect) to test1.php and open it once again, I get:
array(1) { ["someVar"]=> &string(5) "Hello" }
If I comment out header in test1.php and uncomment the HTML hyperlink
and go to test2.php using it, it works from the first time.
Thanks for any help solving this issue.
Cheers,
Donny
PS. My php.ini settings regarding sessions:
session.auto_start
Off Off
session.cache_expire
180 180
session.cache_limiter
nocache nocache
session.cookie_domain
no value no value
session.cookie_lifetime
0 0
session.cookie_path
/ /
session.cookie_secure
Off Off
session.entropy_file
no value no value
session.entropy_length
0 0
session.gc_maxlifetime
1440 1440
session.gc_probability
1 1
session.name
PHPSESSID PHPSESSID
session.referer_check
no value no value
session.save_handler
files files
session.save_path
c:/winnt/temp/ C:\php4.2.3\sessiondata
session.serialize_handler
php php
session.use_cookies
On On
session.use_trans_sid
1 1
<--------------------===================================-------------------->
Mažėja “Omnitel” paslaugų kainos privatiems abonentams!
SMS žinučių kaina - iki 20%
Minimalūs paslaugos mokesčiai - iki 33%
Pokalbių tarifai - iki 33% (naujas planas DRAUGAI 60)
http://www.omnitel.lt/?m_lt$79357_94571#z110474
--- End Message ---
--- Begin Message ---
One of the things that can be happening is that the server is sending
the "location:" before the session data in the header... and when the
browser gets it, simply forgots the session data.
I'm not sure of in which version of PHP there was a problem like the one
i'm describing, but i remember very well that i've made a Javascript
redirector to place in the end of the page (after the session
manipulation) to force the current page to go to the browser whole and
then in the browser be redirected to the new page where the session was
needed...
Hope to have been usefull (and perceptible, from my english ;) )
Luis Ferro
Donatas wrote:
First some data about my setup:
PHP 4.2.3 (I bet nothing has changed till PHP 4.3.2 regarding
sessions) running on Windows 2K server
My PC:
Windows 98 SE
Browser:
IE 6.0.2600.0000
Now, the problem occurs when using sessions and header
('Location: ...');
test1.php
/**********************/
<?
session_save_path ('c:/winnt/temp/'); //making sure that the path
is correct, I override any value set in php.ini
session_start ();
$_SESSION ['someVar'] = 'Hello';
session_write_close (); //saving session data and closing it
header ("Location: http://hqserver/....../test2.php");
//echo '<a href="http://hqserver/....../test2.php">To
test2.php</a>';
?>
test2.php
/**********************/
<?
session_save_path ('c:/winnt/temp/');
session_start ();
var_dump ($_SESSION);
?>
So, when I first open browser and go to test1.php I get redirected to
test2.php and see this output:
array(0) { }
When I edit the link in IE linkfield from test2.php (rememeber..
there was a redirect) to test1.php and open it once again, I get:
array(1) { ["someVar"]=> &string(5) "Hello" }
If I comment out header in test1.php and uncomment the HTML hyperlink
and go to test2.php using it, it works from the first time.
Thanks for any help solving this issue.
Cheers,
Donny
PS. My php.ini settings regarding sessions:
session.auto_start
Off Off
session.cache_expire
180 180
session.cache_limiter
nocache nocache
session.cookie_domain
no value no value
session.cookie_lifetime
0 0
session.cookie_path
/ /
session.cookie_secure
Off Off
session.entropy_file
no value no value
session.entropy_length
0 0
session.gc_maxlifetime
1440 1440
session.gc_probability
1 1
session.name
PHPSESSID PHPSESSID
session.referer_check
no value no value
session.save_handler
files files
session.save_path
c:/winnt/temp/ C:\php4.2.3\sessiondata
session.serialize_handler
php php
session.use_cookies
On On
session.use_trans_sid
1 1
<--------------------===================================-------------------->
Mažėja “Omnitel” paslaugų kainos privatiems abonentams!
SMS žinučių kaina - iki 20%
Minimalūs paslaugos mokesčiai - iki 33%
Pokalbių tarifai - iki 33% (naujas planas DRAUGAI 60)
http://www.omnitel.lt/?m_lt$79357_94571#z110474
--- End Message ---
--- Begin Message ---
Thanks Luis,
I had this idea in mind, but still... maybe someone knows a way how to
achieve same effect without using JavaScript? Not that I don't like it but
that there should be some way.
PS. Your english is just as great as mine :D
-----Original Message-----
From: Luis Ferro [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 10, 2003 4:56 PM
To: [EMAIL PROTECTED]
One of the things that can be happening is that the server is sending
the "location:" before the session data in the header... and when the
browser gets it, simply forgots the session data.
I'm not sure of in which version of PHP there was a problem like the one
i'm describing, but i remember very well that i've made a Javascript
redirector to place in the end of the page (after the session
manipulation) to force the current page to go to the browser whole and
then in the browser be redirected to the new page where the session was
needed...
Hope to have been usefull (and perceptible, from my english ;) )
Luis Ferro
Donatas wrote:
>First some data about my setup:
>PHP 4.2.3 (I bet nothing has changed till PHP 4.3.2 regarding
>sessions) running on Windows 2K server
>
>My PC:
>Windows 98 SE
>Browser:
>IE 6.0.2600.0000
>
>Now, the problem occurs when using sessions and header
>('Location: ...');
>
>test1.php
>/**********************/
><?
> session_save_path ('c:/winnt/temp/'); //making sure that the path
>is correct, I override any value set in php.ini
> session_start ();
>
> $_SESSION ['someVar'] = 'Hello';
> session_write_close (); //saving session data and closing it
> header ("Location: http://hqserver/....../test2.php");
>
> //echo '<a href="http://hqserver/....../test2.php">To
>test2.php</a>';
>?>
>
>test2.php
>/**********************/
><?
> session_save_path ('c:/winnt/temp/');
> session_start ();
> var_dump ($_SESSION);
>?>
>
>So, when I first open browser and go to test1.php I get redirected to
>test2.php and see this output:
>array(0) { }
>When I edit the link in IE linkfield from test2.php (rememeber..
>there was a redirect) to test1.php and open it once again, I get:
>array(1) { ["someVar"]=> &string(5) "Hello" }
>
>If I comment out header in test1.php and uncomment the HTML hyperlink
>and go to test2.php using it, it works from the first time.
>
>
>Thanks for any help solving this issue.
>
>Cheers,
>Donny
>
>PS. My php.ini settings regarding sessions:
>
>session.auto_start
> Off Off
>session.cache_expire
> 180 180
>session.cache_limiter
> nocache nocache
>session.cookie_domain
> no value no value
>session.cookie_lifetime
> 0 0
>session.cookie_path
> / /
>session.cookie_secure
> Off Off
>session.entropy_file
> no value no value
>session.entropy_length
> 0 0
>session.gc_maxlifetime
> 1440 1440
>session.gc_probability
> 1 1
>session.name
> PHPSESSID PHPSESSID
>session.referer_check
> no value no value
>session.save_handler
> files files
>session.save_path
> c:/winnt/temp/ C:\php4.2.3\sessiondata
>session.serialize_handler
> php php
>session.use_cookies
> On On
>session.use_trans_sid
> 1 1
--- End Message ---
--- Begin Message ---
dsd
--- End Message ---