php-general Digest 24 Feb 2011 04:48:28 -0000 Issue 7197
Topics (messages 311536 through 311551):
Re: Dynamically Created Checkboxes
311536 by: Gary
311538 by: Jim Lucas
311540 by: Gary
311543 by: Gary
311546 by: Steve Staples
311547 by: Gary
311549 by: Steve Staples
Re: How to write code: how wrong am I?
311537 by: Tamara Temple
311539 by: Dotan Cohen
Does requesting $_SERVER variables need to query the server
311541 by: Marc Guay
311542 by: Shreyas Agasthya
311544 by: Daniel P. Brown
311545 by: Marc Guay
311548 by: Marc Guay
Re: Large binary objects in MySQL
311550 by: Florin Jurcovici
Manipulating variables
311551 by: Ron Piggott
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 ---
"Pete Ford" <[email protected]> wrote in message
news:[email protected]...
> This bit?
>
> On 22/02/11 22:06, Gary wrote:
>> for($i=1; $i<=$_POST['counties']; $i++) {
>> if ( isset($_POST["county{$i}"] ) ) {
>
> You loop over $_POST['counties'] and look for $_POST["county$i"]
>
> I suspect that there is no field 'counties' in your form, so the server is
> complaining about the missing index - seems likely that the production
> server
> is not showing the error, but instead just giving up on the page.
>
> I think the IE7/Firefox browser difference is a red herring: it wasn't
> actually working in any browser, or the code changed between tests.
> Remember, PHP is server side and generates HTML (or whatever). Unless you
> tell the PHP what browser you are using and write PHP code to take account
> of that (not generally recommended) then the server output is the same
> regardless of browser.
>
> --
> Peter Ford, Developer phone: 01580 893333 fax: 01580
> 893399
> Justcroft International Ltd.
> www.justcroft.com
> Justcroft House, High Street, Staplehurst, Kent TN12 0AH United
> Kingdom
> Registered in England and Wales: 2297906
> Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17
> 1XS
Pete
Once again, thank you for your help.
I was able to get it to work, I did not understand the browser differences
either, but on my testing server on IE, it worked as I wanted but not on
anything else. I chopped out most of the code and ended up with this:
if ( isset($_POST['submit']) ) {} else {
print "<form action=\"phpForm3.php\" method=\"POST\">\n";
if ($Recordset1) {
print "<table width=200 border=1>\n";
print "<th> </th>\n";
print "<th> State </th>\n"; //2 fields in Counties table, State and County
print "<th> County </th>\n";
print "</tr>\n";
//create table
$i = 0;
while ( $row = mysql_fetch_array($Recordset1) ) {
$i++;
print "<tr>\n";
print "<td><input type=\"checkbox\" name=\"county$i\"
value=\"$row[name]\"></td>\n";
echo "<td>{$row['state_id']}</td>\n";
echo "<td>{$row['name']}</td>\n";
echo "</tr>\n";
}//end while
print "</table>\n";
} else {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
}
print "<input type=\"hidden\" name=\"counties\" value=\"$i\"/>\n";
print "<input type=\"submit\" name=\"submit\" value=\"Go\"/>\n";
}
?>
Again, thank you.
Gary
__________ Information from ESET Smart Security, version of virus signature
database 5899 (20110223) __________
The message was checked by ESET Smart Security.
http://www.eset.com
--- End Message ---
--- Begin Message ---
On 2/23/2011 4:35 AM, Gary wrote:
> "Pete Ford" <[email protected]> wrote in message
> news:[email protected]...
>> This bit?
>>
>> On 22/02/11 22:06, Gary wrote:
>>> for($i=1; $i<=$_POST['counties']; $i++) {
>>> if ( isset($_POST["county{$i}"] ) ) {
>>
>> You loop over $_POST['counties'] and look for $_POST["county$i"]
>>
>> I suspect that there is no field 'counties' in your form, so the server is
>> complaining about the missing index - seems likely that the production
>> server
>> is not showing the error, but instead just giving up on the page.
>>
>> I think the IE7/Firefox browser difference is a red herring: it wasn't
>> actually working in any browser, or the code changed between tests.
>> Remember, PHP is server side and generates HTML (or whatever). Unless you
>> tell the PHP what browser you are using and write PHP code to take account
>> of that (not generally recommended) then the server output is the same
>> regardless of browser.
>>
>> --
>> Peter Ford, Developer phone: 01580 893333 fax: 01580
>> 893399
>> Justcroft International Ltd.
>> www.justcroft.com
>> Justcroft House, High Street, Staplehurst, Kent TN12 0AH United
>> Kingdom
>> Registered in England and Wales: 2297906
>> Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17
>> 1XS
>
>
> Pete
>
> Once again, thank you for your help.
>
> I was able to get it to work, I did not understand the browser differences
> either, but on my testing server on IE, it worked as I wanted but not on
> anything else. I chopped out most of the code and ended up with this:
>
> if ( isset($_POST['submit']) ) {} else {
> print "<form action=\"phpForm3.php\" method=\"POST\">\n";
> if ($Recordset1) {
> print "<table width=200 border=1>\n";
> print "<th> </th>\n";
> print "<th> State </th>\n"; //2 fields in Counties table, State and County
> print "<th> County </th>\n";
> print "</tr>\n";
> //create table
> $i = 0;
> while ( $row = mysql_fetch_array($Recordset1) ) {
> $i++;
> print "<tr>\n";
> print "<td><input type=\"checkbox\" name=\"county$i\"
> value=\"$row[name]\"></td>\n";
> echo "<td>{$row['state_id']}</td>\n";
> echo "<td>{$row['name']}</td>\n";
> echo "</tr>\n";
> }//end while
> print "</table>\n";
> } else {
> echo("<P>Error performing query: " .
> mysql_error() . "</P>");
> }
> print "<input type=\"hidden\" name=\"counties\" value=\"$i\"/>\n";
> print "<input type=\"submit\" name=\"submit\" value=\"Go\"/>\n";
> }
> ?>
>
> Again, thank you.
>
> Gary
>
> __________ Information from ESET Smart Security, version of virus signature
> database 5899 (20110223) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
If you would allow me to show you a little easier way of doing this.
if ( !isset($_POST['submit']) ) {
echo '<form action="phpForm3.php" method="POST">';
if ($Recordset1) {
echo <<<HEADER
<table width=200 border=1>
<tr><th> </th><th> State </th><th> County </th></tr>
HEADER;
while ( $row = mysql_fetch_array($Recordset1) ) {
echo <<<ROW
<tr>
<td><input type="checkbox" name="county[]" value="{$row['name']}"></td>
<td>{$row['state_id']}</td>
<td>{$row['name']}</td>
</tr>
ROW;
}//end while
echo '</table>';
} else {
echo '<p>Error performing query: '.mysql_error().'</p>';
}
echo '<input type="submit" name="submit" value="Go" />';
}
Now, the main thing I want you to see is the line for the country checkbox'es
The county[] turns the submitted values into an array. So, in the processing
script, you would do this.
<?php
...
if ( !empty($_POST['county'])
foreach ( $_POST['county'] AS $id => $name )
echo "{$id} {$name}\n";
...
?>
Hope this clears things up for you a little.
Enjoy.
Jim
--- End Message ---
--- Begin Message ---
"Jim Lucas" <[email protected]> wrote in message
news:[email protected]...
> On 2/23/2011 4:35 AM, Gary wrote:
>> "Pete Ford" <[email protected]> wrote in message
>> news:[email protected]...
>>> This bit?
>>>
>>> On 22/02/11 22:06, Gary wrote:
>>>> for($i=1; $i<=$_POST['counties']; $i++) {
>>>> if ( isset($_POST["county{$i}"] ) ) {
>>>
>>> You loop over $_POST['counties'] and look for $_POST["county$i"]
>>>
>>> I suspect that there is no field 'counties' in your form, so the server
>>> is
>>> complaining about the missing index - seems likely that the production
>>> server
>>> is not showing the error, but instead just giving up on the page.
>>>
>>> I think the IE7/Firefox browser difference is a red herring: it wasn't
>>> actually working in any browser, or the code changed between tests.
>>> Remember, PHP is server side and generates HTML (or whatever). Unless
>>> you
>>> tell the PHP what browser you are using and write PHP code to take
>>> account
>>> of that (not generally recommended) then the server output is the same
>>> regardless of browser.
>>>
>>> --
>>> Peter Ford, Developer phone: 01580 893333 fax: 01580
>>> 893399
>>> Justcroft International Ltd.
>>> www.justcroft.com
>>> Justcroft House, High Street, Staplehurst, Kent TN12 0AH United
>>> Kingdom
>>> Registered in England and Wales: 2297906
>>> Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17
>>> 1XS
>>
>>
>> Pete
>>
>> Once again, thank you for your help.
>>
>> I was able to get it to work, I did not understand the browser
>> differences
>> either, but on my testing server on IE, it worked as I wanted but not on
>> anything else. I chopped out most of the code and ended up with this:
>>
>> if ( isset($_POST['submit']) ) {} else {
>> print "<form action=\"phpForm3.php\" method=\"POST\">\n";
>> if ($Recordset1) {
>> print "<table width=200 border=1>\n";
>> print "<th> </th>\n";
>> print "<th> State </th>\n"; //2 fields in Counties table, State and
>> County
>> print "<th> County </th>\n";
>> print "</tr>\n";
>> //create table
>> $i = 0;
>> while ( $row = mysql_fetch_array($Recordset1) ) {
>> $i++;
>> print "<tr>\n";
>> print "<td><input type=\"checkbox\" name=\"county$i\"
>> value=\"$row[name]\"></td>\n";
>> echo "<td>{$row['state_id']}</td>\n";
>> echo "<td>{$row['name']}</td>\n";
>> echo "</tr>\n";
>> }//end while
>> print "</table>\n";
>> } else {
>> echo("<P>Error performing query: " .
>> mysql_error() . "</P>");
>> }
>> print "<input type=\"hidden\" name=\"counties\" value=\"$i\"/>\n";
>> print "<input type=\"submit\" name=\"submit\" value=\"Go\"/>\n";
>> }
>> ?>
>>
>> Again, thank you.
>>
>> Gary
>>
>> __________ Information from ESET Smart Security, version of virus
>> signature database 5899 (20110223) __________
>>
>> The message was checked by ESET Smart Security.
>>
>> http://www.eset.com
>>
>
> If you would allow me to show you a little easier way of doing this.
>
> if ( !isset($_POST['submit']) ) {
> echo '<form action="phpForm3.php" method="POST">';
> if ($Recordset1) {
> echo <<<HEADER
> <table width=200 border=1>
> <tr><th> </th><th> State </th><th> County </th></tr>
> HEADER;
> while ( $row = mysql_fetch_array($Recordset1) ) {
> echo <<<ROW
> <tr>
> <td><input type="checkbox" name="county[]" value="{$row['name']}"></td>
> <td>{$row['state_id']}</td>
> <td>{$row['name']}</td>
> </tr>
> ROW;
> }//end while
> echo '</table>';
> } else {
> echo '<p>Error performing query: '.mysql_error().'</p>';
> }
> echo '<input type="submit" name="submit" value="Go" />';
> }
>
> Now, the main thing I want you to see is the line for the country
> checkbox'es
>
> The county[] turns the submitted values into an array. So, in the
> processing
> script, you would do this.
>
> <?php
>
> ...
>
> if ( !empty($_POST['county'])
> foreach ( $_POST['county'] AS $id => $name )
> echo "{$id} {$name}\n";
>
> ...
> ?>
>
> Hope this clears things up for you a little.
>
> Enjoy.
>
> Jim
Jim
Thank you very much, I have adapted your code and it is working. I
appriciate your help.
Gary
__________ Information from ESET Smart Security, version of virus signature
database 5900 (20110223) __________
The message was checked by ESET Smart Security.
http://www.eset.com
--- End Message ---
--- Begin Message ---
"Jim Lucas" <[email protected]> wrote in message
news:[email protected]...
> On 2/23/2011 4:35 AM, Gary wrote:
>> "Pete Ford" <[email protected]> wrote in message
>> news:[email protected]...
>>> This bit?
>>>
>>> On 22/02/11 22:06, Gary wrote:
>>>> for($i=1; $i<=$_POST['counties']; $i++) {
>>>> if ( isset($_POST["county{$i}"] ) ) {
>>>
>>> You loop over $_POST['counties'] and look for $_POST["county$i"]
>>>
>>> I suspect that there is no field 'counties' in your form, so the server
>>> is
>>> complaining about the missing index - seems likely that the production
>>> server
>>> is not showing the error, but instead just giving up on the page.
>>>
>>> I think the IE7/Firefox browser difference is a red herring: it wasn't
>>> actually working in any browser, or the code changed between tests.
>>> Remember, PHP is server side and generates HTML (or whatever). Unless
>>> you
>>> tell the PHP what browser you are using and write PHP code to take
>>> account
>>> of that (not generally recommended) then the server output is the same
>>> regardless of browser.
>>>
>>> --
>>> Peter Ford, Developer phone: 01580 893333 fax: 01580
>>> 893399
>>> Justcroft International Ltd.
>>> www.justcroft.com
>>> Justcroft House, High Street, Staplehurst, Kent TN12 0AH United
>>> Kingdom
>>> Registered in England and Wales: 2297906
>>> Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17
>>> 1XS
>>
>>
>> Pete
>>
>> Once again, thank you for your help.
>>
>> I was able to get it to work, I did not understand the browser
>> differences
>> either, but on my testing server on IE, it worked as I wanted but not on
>> anything else. I chopped out most of the code and ended up with this:
>>
>> if ( isset($_POST['submit']) ) {} else {
>> print "<form action=\"phpForm3.php\" method=\"POST\">\n";
>> if ($Recordset1) {
>> print "<table width=200 border=1>\n";
>> print "<th> </th>\n";
>> print "<th> State </th>\n"; //2 fields in Counties table, State and
>> County
>> print "<th> County </th>\n";
>> print "</tr>\n";
>> //create table
>> $i = 0;
>> while ( $row = mysql_fetch_array($Recordset1) ) {
>> $i++;
>> print "<tr>\n";
>> print "<td><input type=\"checkbox\" name=\"county$i\"
>> value=\"$row[name]\"></td>\n";
>> echo "<td>{$row['state_id']}</td>\n";
>> echo "<td>{$row['name']}</td>\n";
>> echo "</tr>\n";
>> }//end while
>> print "</table>\n";
>> } else {
>> echo("<P>Error performing query: " .
>> mysql_error() . "</P>");
>> }
>> print "<input type=\"hidden\" name=\"counties\" value=\"$i\"/>\n";
>> print "<input type=\"submit\" name=\"submit\" value=\"Go\"/>\n";
>> }
>> ?>
>>
>> Again, thank you.
>>
>> Gary
>>
>> __________ Information from ESET Smart Security, version of virus
>> signature database 5899 (20110223) __________
>>
>> The message was checked by ESET Smart Security.
>>
>> http://www.eset.com
>>
>
> If you would allow me to show you a little easier way of doing this.
>
> if ( !isset($_POST['submit']) ) {
> echo '<form action="phpForm3.php" method="POST">';
> if ($Recordset1) {
> echo <<<HEADER
> <table width=200 border=1>
> <tr><th> </th><th> State </th><th> County </th></tr>
> HEADER;
> while ( $row = mysql_fetch_array($Recordset1) ) {
> echo <<<ROW
> <tr>
> <td><input type="checkbox" name="county[]" value="{$row['name']}"></td>
> <td>{$row['state_id']}</td>
> <td>{$row['name']}</td>
> </tr>
> ROW;
> }//end while
> echo '</table>';
> } else {
> echo '<p>Error performing query: '.mysql_error().'</p>';
> }
> echo '<input type="submit" name="submit" value="Go" />';
> }
>
> Now, the main thing I want you to see is the line for the country
> checkbox'es
>
> The county[] turns the submitted values into an array. So, in the
> processing
> script, you would do this.
>
> <?php
>
> ...
>
> if ( !empty($_POST['county'])
> foreach ( $_POST['county'] AS $id => $name )
> echo "{$id} {$name}\n";
>
> ...
> ?>
>
> Hope this clears things up for you a little.
>
> Enjoy.
>
> Jim
In a weird twist, I have/had the script working, but again it is not
working in FF or Chrome. This is a link to the first page which runs you
through the pages.
I have the submit to trigger upon change so there is no submit button. This
works in IE7. If I add a submit button, it does not work in any of them.
I am wondering if this is more a problem with the html.
http://www.assessmentappeallawyer.com/forum_state.php
This is the code for the first processing page
if ( !isset($_POST['submit']) ) {
echo '<form action="forum_delete.php" method="POST">';
if ($Recordset1) {
echo <<<HEADER
<table width=200 border=0>
<tr><th> </th><th> State </th><th> County </th></tr>
HEADER;
while ( $row = mysql_fetch_array($Recordset1) ) {
echo <<<ROW
<tr>
<td><input type="checkbox" name="county[]" value="{$row['name']}"></td>
<td>{$row['state_id']}</td>
<td>{$row['name']}</td>
</tr>
ROW;
}//end while
echo '</table>';
} else {
echo '<p>Error performing query: '.mysql_error().'</p>';
}
echo '<input type="submit" name="submit" value="Select" />';
}
?>
****This is the code for the second processing page.
<?php
if ( !empty($_POST['county']))
foreach ( $_POST['county'] AS $id => $name )
echo 'You have selected '. " {$name}".'<br />';
$totalRows_county_result_net= "($totalRows_county_result) + (1)";
echo "[$totalRows_county_result_net]";
echo "$totalRows_county_result";
?>
</div>
<!--eo center-->
<?php
$name=$_POST['name'];
echo 'You have selected'."$name";
?>
<?php
mysql_free_result($county_result);
?>
Again, thank you for any input.
Gary
__________ Information from ESET Smart Security, version of virus signature
database 5900 (20110223) __________
The message was checked by ESET Smart Security.
http://www.eset.com
--- End Message ---
--- Begin Message ---
On Wed, 2011-02-23 at 14:17 -0500, Gary wrote:
> "Jim Lucas" <[email protected]> wrote in message
> news:[email protected]...
> > On 2/23/2011 4:35 AM, Gary wrote:
> >> "Pete Ford" <[email protected]> wrote in message
> >> news:[email protected]...
> >>> This bit?
> >>>
> >>> On 22/02/11 22:06, Gary wrote:
> >>>> for($i=1; $i<=$_POST['counties']; $i++) {
> >>>> if ( isset($_POST["county{$i}"] ) ) {
> >>>
> >>> You loop over $_POST['counties'] and look for $_POST["county$i"]
> >>>
> >>> I suspect that there is no field 'counties' in your form, so the server
> >>> is
> >>> complaining about the missing index - seems likely that the production
> >>> server
> >>> is not showing the error, but instead just giving up on the page.
> >>>
> >>> I think the IE7/Firefox browser difference is a red herring: it wasn't
> >>> actually working in any browser, or the code changed between tests.
> >>> Remember, PHP is server side and generates HTML (or whatever). Unless
> >>> you
> >>> tell the PHP what browser you are using and write PHP code to take
> >>> account
> >>> of that (not generally recommended) then the server output is the same
> >>> regardless of browser.
> >>>
> >>> --
> >>> Peter Ford, Developer phone: 01580 893333 fax: 01580
> >>> 893399
> >>> Justcroft International Ltd.
> >>> www.justcroft.com
> >>> Justcroft House, High Street, Staplehurst, Kent TN12 0AH United
> >>> Kingdom
> >>> Registered in England and Wales: 2297906
> >>> Registered office: Stag Gates House, 63/64 The Avenue, Southampton SO17
> >>> 1XS
> >>
> >>
> >> Pete
> >>
> >> Once again, thank you for your help.
> >>
> >> I was able to get it to work, I did not understand the browser
> >> differences
> >> either, but on my testing server on IE, it worked as I wanted but not on
> >> anything else. I chopped out most of the code and ended up with this:
> >>
> >> if ( isset($_POST['submit']) ) {} else {
> >> print "<form action=\"phpForm3.php\" method=\"POST\">\n";
> >> if ($Recordset1) {
> >> print "<table width=200 border=1>\n";
> >> print "<th> </th>\n";
> >> print "<th> State </th>\n"; //2 fields in Counties table, State and
> >> County
> >> print "<th> County </th>\n";
> >> print "</tr>\n";
> >> //create table
> >> $i = 0;
> >> while ( $row = mysql_fetch_array($Recordset1) ) {
> >> $i++;
> >> print "<tr>\n";
> >> print "<td><input type=\"checkbox\" name=\"county$i\"
> >> value=\"$row[name]\"></td>\n";
> >> echo "<td>{$row['state_id']}</td>\n";
> >> echo "<td>{$row['name']}</td>\n";
> >> echo "</tr>\n";
> >> }//end while
> >> print "</table>\n";
> >> } else {
> >> echo("<P>Error performing query: " .
> >> mysql_error() . "</P>");
> >> }
> >> print "<input type=\"hidden\" name=\"counties\" value=\"$i\"/>\n";
> >> print "<input type=\"submit\" name=\"submit\" value=\"Go\"/>\n";
> >> }
> >> ?>
> >>
> >> Again, thank you.
> >>
> >> Gary
> >>
> >> __________ Information from ESET Smart Security, version of virus
> >> signature database 5899 (20110223) __________
> >>
> >> The message was checked by ESET Smart Security.
> >>
> >> http://www.eset.com
> >>
> >
> > If you would allow me to show you a little easier way of doing this.
> >
> > if ( !isset($_POST['submit']) ) {
> > echo '<form action="phpForm3.php" method="POST">';
> > if ($Recordset1) {
> > echo <<<HEADER
> > <table width=200 border=1>
> > <tr><th> </th><th> State </th><th> County </th></tr>
> > HEADER;
> > while ( $row = mysql_fetch_array($Recordset1) ) {
> > echo <<<ROW
> > <tr>
> > <td><input type="checkbox" name="county[]" value="{$row['name']}"></td>
> > <td>{$row['state_id']}</td>
> > <td>{$row['name']}</td>
> > </tr>
> > ROW;
> > }//end while
> > echo '</table>';
> > } else {
> > echo '<p>Error performing query: '.mysql_error().'</p>';
> > }
> > echo '<input type="submit" name="submit" value="Go" />';
> > }
> >
> > Now, the main thing I want you to see is the line for the country
> > checkbox'es
> >
> > The county[] turns the submitted values into an array. So, in the
> > processing
> > script, you would do this.
> >
> > <?php
> >
> > ...
> >
> > if ( !empty($_POST['county'])
> > foreach ( $_POST['county'] AS $id => $name )
> > echo "{$id} {$name}\n";
> >
> > ...
> > ?>
> >
> > Hope this clears things up for you a little.
> >
> > Enjoy.
> >
> > Jim
>
> In a weird twist, I have/had the script working, but again it is not
> working in FF or Chrome. This is a link to the first page which runs you
> through the pages.
>
> I have the submit to trigger upon change so there is no submit button. This
> works in IE7. If I add a submit button, it does not work in any of them.
>
> I am wondering if this is more a problem with the html.
>
>
> http://www.assessmentappeallawyer.com/forum_state.php
>
> This is the code for the first processing page
>
> if ( !isset($_POST['submit']) ) {
> echo '<form action="forum_delete.php" method="POST">';
> if ($Recordset1) {
> echo <<<HEADER
> <table width=200 border=0>
> <tr><th> </th><th> State </th><th> County </th></tr>
> HEADER;
> while ( $row = mysql_fetch_array($Recordset1) ) {
> echo <<<ROW
> <tr>
> <td><input type="checkbox" name="county[]" value="{$row['name']}"></td>
> <td>{$row['state_id']}</td>
> <td>{$row['name']}</td>
> </tr>
> ROW;
> }//end while
> echo '</table>';
> } else {
> echo '<p>Error performing query: '.mysql_error().'</p>';
> }
> echo '<input type="submit" name="submit" value="Select" />';
> }
>
> ?>
>
> ****This is the code for the second processing page.
>
>
> <?php
>
>
> if ( !empty($_POST['county']))
> foreach ( $_POST['county'] AS $id => $name )
> echo 'You have selected '. " {$name}".'<br />';
>
>
>
> $totalRows_county_result_net= "($totalRows_county_result) + (1)";
> echo "[$totalRows_county_result_net]";
> echo "$totalRows_county_result";
> ?>
> </div>
> <!--eo center-->
>
>
> <?php
> $name=$_POST['name'];
> echo 'You have selected'."$name";
>
> ?>
> <?php
> mysql_free_result($county_result);
> ?>
>
> Again, thank you for any input.
>
> Gary
I think it may have to do with HTML, or the fact that IE is "helping"
you with your coding... where FF and Chrome are usually more
"literal" (yet better IMO). Also, the fact that "submit" has not been
defined.
try adding:
<input type="submit" name="submit" value="submit" style="display:
none;" />
This *SHOULD* give you the submit button, but the style is "hidden" now,
so it shouldn't show, but it will fire off the "submit" action... make
sure it is in between the <form></form> tags though.
Steve
--- End Message ---
--- Begin Message ---
"Steve Staples" <[email protected]> wrote in message
news:1298490417.14826.2418.camel@webdev01...
> On Wed, 2011-02-23 at 14:17 -0500, Gary wrote:
>> "Jim Lucas" <[email protected]> wrote in message
>> news:[email protected]...
>> > On 2/23/2011 4:35 AM, Gary wrote:
>> >> "Pete Ford" <[email protected]> wrote in message
>> >> news:[email protected]...
>> >>> This bit?
>> >>>
>> >>> On 22/02/11 22:06, Gary wrote:
>> >>>> for($i=1; $i<=$_POST['counties']; $i++) {
>> >>>> if ( isset($_POST["county{$i}"] ) ) {
>> >>>
>> >>> You loop over $_POST['counties'] and look for $_POST["county$i"]
>> >>>
>> >>> I suspect that there is no field 'counties' in your form, so the
>> >>> server
>> >>> is
>> >>> complaining about the missing index - seems likely that the
>> >>> production
>> >>> server
>> >>> is not showing the error, but instead just giving up on the page.
>> >>>
>> >>> I think the IE7/Firefox browser difference is a red herring: it
>> >>> wasn't
>> >>> actually working in any browser, or the code changed between tests.
>> >>> Remember, PHP is server side and generates HTML (or whatever). Unless
>> >>> you
>> >>> tell the PHP what browser you are using and write PHP code to take
>> >>> account
>> >>> of that (not generally recommended) then the server output is the
>> >>> same
>> >>> regardless of browser.
>> >>>
>> >>> --
>> >>> Peter Ford, Developer phone: 01580 893333 fax: 01580
>> >>> 893399
>> >>> Justcroft International Ltd.
>> >>> www.justcroft.com
>> >>> Justcroft House, High Street, Staplehurst, Kent TN12 0AH United
>> >>> Kingdom
>> >>> Registered in England and Wales: 2297906
>> >>> Registered office: Stag Gates House, 63/64 The Avenue, Southampton
>> >>> SO17
>> >>> 1XS
>> >>
>> >>
>> >> Pete
>> >>
>> >> Once again, thank you for your help.
>> >>
>> >> I was able to get it to work, I did not understand the browser
>> >> differences
>> >> either, but on my testing server on IE, it worked as I wanted but not
>> >> on
>> >> anything else. I chopped out most of the code and ended up with this:
>> >>
>> >> if ( isset($_POST['submit']) ) {} else {
>> >> print "<form action=\"phpForm3.php\" method=\"POST\">\n";
>> >> if ($Recordset1) {
>> >> print "<table width=200 border=1>\n";
>> >> print "<th> </th>\n";
>> >> print "<th> State </th>\n"; //2 fields in Counties table, State and
>> >> County
>> >> print "<th> County </th>\n";
>> >> print "</tr>\n";
>> >> //create table
>> >> $i = 0;
>> >> while ( $row = mysql_fetch_array($Recordset1) ) {
>> >> $i++;
>> >> print "<tr>\n";
>> >> print "<td><input type=\"checkbox\" name=\"county$i\"
>> >> value=\"$row[name]\"></td>\n";
>> >> echo "<td>{$row['state_id']}</td>\n";
>> >> echo "<td>{$row['name']}</td>\n";
>> >> echo "</tr>\n";
>> >> }//end while
>> >> print "</table>\n";
>> >> } else {
>> >> echo("<P>Error performing query: " .
>> >> mysql_error() . "</P>");
>> >> }
>> >> print "<input type=\"hidden\" name=\"counties\" value=\"$i\"/>\n";
>> >> print "<input type=\"submit\" name=\"submit\" value=\"Go\"/>\n";
>> >> }
>> >> ?>
>> >>
>> >> Again, thank you.
>> >>
>> >> Gary
>> >>
>> >> __________ Information from ESET Smart Security, version of virus
>> >> signature database 5899 (20110223) __________
>> >>
>> >> The message was checked by ESET Smart Security.
>> >>
>> >> http://www.eset.com
>> >>
>> >
>> > If you would allow me to show you a little easier way of doing this.
>> >
>> > if ( !isset($_POST['submit']) ) {
>> > echo '<form action="phpForm3.php" method="POST">';
>> > if ($Recordset1) {
>> > echo <<<HEADER
>> > <table width=200 border=1>
>> > <tr><th> </th><th> State </th><th> County </th></tr>
>> > HEADER;
>> > while ( $row = mysql_fetch_array($Recordset1) ) {
>> > echo <<<ROW
>> > <tr>
>> > <td><input type="checkbox" name="county[]"
>> > value="{$row['name']}"></td>
>> > <td>{$row['state_id']}</td>
>> > <td>{$row['name']}</td>
>> > </tr>
>> > ROW;
>> > }//end while
>> > echo '</table>';
>> > } else {
>> > echo '<p>Error performing query: '.mysql_error().'</p>';
>> > }
>> > echo '<input type="submit" name="submit" value="Go" />';
>> > }
>> >
>> > Now, the main thing I want you to see is the line for the country
>> > checkbox'es
>> >
>> > The county[] turns the submitted values into an array. So, in the
>> > processing
>> > script, you would do this.
>> >
>> > <?php
>> >
>> > ...
>> >
>> > if ( !empty($_POST['county'])
>> > foreach ( $_POST['county'] AS $id => $name )
>> > echo "{$id} {$name}\n";
>> >
>> > ...
>> > ?>
>> >
>> > Hope this clears things up for you a little.
>> >
>> > Enjoy.
>> >
>> > Jim
>>
>> In a weird twist, I have/had the script working, but again it is not
>> working in FF or Chrome. This is a link to the first page which runs you
>> through the pages.
>>
>> I have the submit to trigger upon change so there is no submit button.
>> This
>> works in IE7. If I add a submit button, it does not work in any of them.
>>
>> I am wondering if this is more a problem with the html.
>>
>>
>> http://www.assessmentappeallawyer.com/forum_state.php
>>
>> This is the code for the first processing page
>>
>> if ( !isset($_POST['submit']) ) {
>> echo '<form action="forum_delete.php" method="POST">';
>> if ($Recordset1) {
>> echo <<<HEADER
>> <table width=200 border=0>
>> <tr><th> </th><th> State </th><th> County </th></tr>
>> HEADER;
>> while ( $row = mysql_fetch_array($Recordset1) ) {
>> echo <<<ROW
>> <tr>
>> <td><input type="checkbox" name="county[]"
>> value="{$row['name']}"></td>
>> <td>{$row['state_id']}</td>
>> <td>{$row['name']}</td>
>> </tr>
>> ROW;
>> }//end while
>> echo '</table>';
>> } else {
>> echo '<p>Error performing query: '.mysql_error().'</p>';
>> }
>> echo '<input type="submit" name="submit" value="Select" />';
>> }
>>
>> ?>
>>
>> ****This is the code for the second processing page.
>>
>>
>> <?php
>>
>>
>> if ( !empty($_POST['county']))
>> foreach ( $_POST['county'] AS $id => $name )
>> echo 'You have selected '. " {$name}".'<br />';
>>
>>
>>
>> $totalRows_county_result_net= "($totalRows_county_result) + (1)";
>> echo "[$totalRows_county_result_net]";
>> echo "$totalRows_county_result";
>> ?>
>> </div>
>> <!--eo center-->
>>
>>
>> <?php
>> $name=$_POST['name'];
>> echo 'You have selected'."$name";
>>
>> ?>
>> <?php
>> mysql_free_result($county_result);
>> ?>
>>
>> Again, thank you for any input.
>>
>> Gary
>
> I think it may have to do with HTML, or the fact that IE is "helping"
> you with your coding... where FF and Chrome are usually more
> "literal" (yet better IMO). Also, the fact that "submit" has not been
> defined.
>
> try adding:
> <input type="submit" name="submit" value="submit" style="display:
> none;" />
>
> This *SHOULD* give you the submit button, but the style is "hidden" now,
> so it shouldn't show, but it will fire off the "submit" action... make
> sure it is in between the <form></form> tags though.
>
> Steve
>
Steve
Thank you for your reply, I had inserted a submit button prior, but it did
not work. I tried your suggestions and got the same result. I am not
seeing anything in the html that should be causing the hick-up, but given
the php is run on the server as Peter pointed out, browser issues with php I
have not really encountered before.
I can live with a submit button, but living with one that does not work...
Thank you for your input, if you see anything else that seems amiss, please
let me know.
Gary
__________ Information from ESET Smart Security, version of virus signature
database 5900 (20110223) __________
The message was checked by ESET Smart Security.
http://www.eset.com
--- End Message ---
--- Begin Message ---
On Wed, 2011-02-23 at 14:56 -0500, Gary wrote:
> "Steve Staples" <[email protected]> wrote in message
> news:1298490417.14826.2418.camel@webdev01...
> > On Wed, 2011-02-23 at 14:17 -0500, Gary wrote:
> >> "Jim Lucas" <[email protected]> wrote in message
> >> news:[email protected]...
> >> > On 2/23/2011 4:35 AM, Gary wrote:
> >> >> "Pete Ford" <[email protected]> wrote in message
> >> >> news:[email protected]...
> >> >>> This bit?
> >> >>>
> >> >>> On 22/02/11 22:06, Gary wrote:
> >> >>>> for($i=1; $i<=$_POST['counties']; $i++) {
> >> >>>> if ( isset($_POST["county{$i}"] ) ) {
> >> >>>
> >> >>> You loop over $_POST['counties'] and look for $_POST["county$i"]
> >> >>>
> >> >>> I suspect that there is no field 'counties' in your form, so the
> >> >>> server
> >> >>> is
> >> >>> complaining about the missing index - seems likely that the
> >> >>> production
> >> >>> server
> >> >>> is not showing the error, but instead just giving up on the page.
> >> >>>
> >> >>> I think the IE7/Firefox browser difference is a red herring: it
> >> >>> wasn't
> >> >>> actually working in any browser, or the code changed between tests.
> >> >>> Remember, PHP is server side and generates HTML (or whatever). Unless
> >> >>> you
> >> >>> tell the PHP what browser you are using and write PHP code to take
> >> >>> account
> >> >>> of that (not generally recommended) then the server output is the
> >> >>> same
> >> >>> regardless of browser.
> >> >>>
> >> >>> --
> >> >>> Peter Ford, Developer phone: 01580 893333 fax: 01580
> >> >>> 893399
> >> >>> Justcroft International Ltd.
> >> >>> www.justcroft.com
> >> >>> Justcroft House, High Street, Staplehurst, Kent TN12 0AH United
> >> >>> Kingdom
> >> >>> Registered in England and Wales: 2297906
> >> >>> Registered office: Stag Gates House, 63/64 The Avenue, Southampton
> >> >>> SO17
> >> >>> 1XS
> >> >>
> >> >>
> >> >> Pete
> >> >>
> >> >> Once again, thank you for your help.
> >> >>
> >> >> I was able to get it to work, I did not understand the browser
> >> >> differences
> >> >> either, but on my testing server on IE, it worked as I wanted but not
> >> >> on
> >> >> anything else. I chopped out most of the code and ended up with this:
> >> >>
> >> >> if ( isset($_POST['submit']) ) {} else {
> >> >> print "<form action=\"phpForm3.php\" method=\"POST\">\n";
> >> >> if ($Recordset1) {
> >> >> print "<table width=200 border=1>\n";
> >> >> print "<th> </th>\n";
> >> >> print "<th> State </th>\n"; //2 fields in Counties table, State and
> >> >> County
> >> >> print "<th> County </th>\n";
> >> >> print "</tr>\n";
> >> >> //create table
> >> >> $i = 0;
> >> >> while ( $row = mysql_fetch_array($Recordset1) ) {
> >> >> $i++;
> >> >> print "<tr>\n";
> >> >> print "<td><input type=\"checkbox\" name=\"county$i\"
> >> >> value=\"$row[name]\"></td>\n";
> >> >> echo "<td>{$row['state_id']}</td>\n";
> >> >> echo "<td>{$row['name']}</td>\n";
> >> >> echo "</tr>\n";
> >> >> }//end while
> >> >> print "</table>\n";
> >> >> } else {
> >> >> echo("<P>Error performing query: " .
> >> >> mysql_error() . "</P>");
> >> >> }
> >> >> print "<input type=\"hidden\" name=\"counties\" value=\"$i\"/>\n";
> >> >> print "<input type=\"submit\" name=\"submit\" value=\"Go\"/>\n";
> >> >> }
> >> >> ?>
> >> >>
> >> >> Again, thank you.
> >> >>
> >> >> Gary
> >> >>
> >> >> __________ Information from ESET Smart Security, version of virus
> >> >> signature database 5899 (20110223) __________
> >> >>
> >> >> The message was checked by ESET Smart Security.
> >> >>
> >> >> http://www.eset.com
> >> >>
> >> >
> >> > If you would allow me to show you a little easier way of doing this.
> >> >
> >> > if ( !isset($_POST['submit']) ) {
> >> > echo '<form action="phpForm3.php" method="POST">';
> >> > if ($Recordset1) {
> >> > echo <<<HEADER
> >> > <table width=200 border=1>
> >> > <tr><th> </th><th> State </th><th> County </th></tr>
> >> > HEADER;
> >> > while ( $row = mysql_fetch_array($Recordset1) ) {
> >> > echo <<<ROW
> >> > <tr>
> >> > <td><input type="checkbox" name="county[]"
> >> > value="{$row['name']}"></td>
> >> > <td>{$row['state_id']}</td>
> >> > <td>{$row['name']}</td>
> >> > </tr>
> >> > ROW;
> >> > }//end while
> >> > echo '</table>';
> >> > } else {
> >> > echo '<p>Error performing query: '.mysql_error().'</p>';
> >> > }
> >> > echo '<input type="submit" name="submit" value="Go" />';
> >> > }
> >> >
> >> > Now, the main thing I want you to see is the line for the country
> >> > checkbox'es
> >> >
> >> > The county[] turns the submitted values into an array. So, in the
> >> > processing
> >> > script, you would do this.
> >> >
> >> > <?php
> >> >
> >> > ...
> >> >
> >> > if ( !empty($_POST['county'])
> >> > foreach ( $_POST['county'] AS $id => $name )
> >> > echo "{$id} {$name}\n";
> >> >
> >> > ...
> >> > ?>
> >> >
> >> > Hope this clears things up for you a little.
> >> >
> >> > Enjoy.
> >> >
> >> > Jim
> >>
> >> In a weird twist, I have/had the script working, but again it is not
> >> working in FF or Chrome. This is a link to the first page which runs you
> >> through the pages.
> >>
> >> I have the submit to trigger upon change so there is no submit button.
> >> This
> >> works in IE7. If I add a submit button, it does not work in any of them.
> >>
> >> I am wondering if this is more a problem with the html.
> >>
> >>
> >> http://www.assessmentappeallawyer.com/forum_state.php
> >>
> >> This is the code for the first processing page
> >>
> >> if ( !isset($_POST['submit']) ) {
> >> echo '<form action="forum_delete.php" method="POST">';
> >> if ($Recordset1) {
> >> echo <<<HEADER
> >> <table width=200 border=0>
> >> <tr><th> </th><th> State </th><th> County </th></tr>
> >> HEADER;
> >> while ( $row = mysql_fetch_array($Recordset1) ) {
> >> echo <<<ROW
> >> <tr>
> >> <td><input type="checkbox" name="county[]"
> >> value="{$row['name']}"></td>
> >> <td>{$row['state_id']}</td>
> >> <td>{$row['name']}</td>
> >> </tr>
> >> ROW;
> >> }//end while
> >> echo '</table>';
> >> } else {
> >> echo '<p>Error performing query: '.mysql_error().'</p>';
> >> }
> >> echo '<input type="submit" name="submit" value="Select" />';
> >> }
> >>
> >> ?>
> >>
> >> ****This is the code for the second processing page.
> >>
> >>
> >> <?php
> >>
> >>
> >> if ( !empty($_POST['county']))
> >> foreach ( $_POST['county'] AS $id => $name )
> >> echo 'You have selected '. " {$name}".'<br />';
> >>
> >>
> >>
> >> $totalRows_county_result_net= "($totalRows_county_result) + (1)";
> >> echo "[$totalRows_county_result_net]";
> >> echo "$totalRows_county_result";
> >> ?>
> >> </div>
> >> <!--eo center-->
> >>
> >>
> >> <?php
> >> $name=$_POST['name'];
> >> echo 'You have selected'."$name";
> >>
> >> ?>
> >> <?php
> >> mysql_free_result($county_result);
> >> ?>
> >>
> >> Again, thank you for any input.
> >>
> >> Gary
> >
> > I think it may have to do with HTML, or the fact that IE is "helping"
> > you with your coding... where FF and Chrome are usually more
> > "literal" (yet better IMO). Also, the fact that "submit" has not been
> > defined.
> >
> > try adding:
> > <input type="submit" name="submit" value="submit" style="display:
> > none;" />
> >
> > This *SHOULD* give you the submit button, but the style is "hidden" now,
> > so it shouldn't show, but it will fire off the "submit" action... make
> > sure it is in between the <form></form> tags though.
> >
> > Steve
> >
> Steve
>
> Thank you for your reply, I had inserted a submit button prior, but it did
> not work. I tried your suggestions and got the same result. I am not
> seeing anything in the html that should be causing the hick-up, but given
> the php is run on the server as Peter pointed out, browser issues with php I
> have not really encountered before.
>
> I can live with a submit button, but living with one that does not work...
>
> Thank you for your input, if you see anything else that seems amiss, please
> let me know.
>
> Gary
>
the <form onchange="submit"> as far as I know, isn't a standard/valid
html attribute... so I would remove it altogether.
http://www.w3schools.com/tags/tag_form.asp
and try on the <select ... onchange=""> to be
<select .... onchange="document.forms["Form1"].submit();">
where Form1 is the id of the form (so add that to the <form...>
<form id="Form1" ... >
try that... (i haven't been testing... my fault... but I am in the midst
of work right now to really test it out)
good luck!
Steve
--- End Message ---
--- Begin Message ---
On Feb 22, 2011, at 5:29 AM, Dotan Cohen wrote:
I wrote a short page on how to actually type of code that one writes,
it can be found here:
http://dotancohen.com/howto/write_code.html
The point that I stress on the page is that first you close an
element, then you fill it's contents. The page has examples in HTML
and PHP. I would like to know what the experienced programmers here
think about this. Am I going about it wrong?
Thanks!
I don't think this is a bad idea at all, in general. This is pretty
much what TextMate does when you use snippet insertion. For editors
that don't have this particular feature, I'll still generally put in
the structure of what i'm doing before filling in all the details.
--- End Message ---
--- Begin Message ---
On Tue, Feb 22, 2011 at 19:03, Paul M Foster <[email protected]> wrote:
> Not a bad idea for HTML, not so great for PHP. Some of what you're
> trying to solve/avoid can be handled by a decent editor, one that does
> syntax highlighting and/or does brace and parenthesis checking. It
> doesn't require an expensive IDE. I use Vim, and it works fine for this.
> And honestly, if you're serious about programming, you really shouldn't
> be using something like Notepad on Windows. Seriously. We had a coder
> working for a company where I was who coded in Word of all things. We
> just looked at him like he was crazy.
>
When I'm writing code in a language I know, I use either Vim, Kate, or
Eclipse. But when I'm learning a language I use an environment with no
syntax highlighting or code completion. It is in these cases that the
close-then-fill coding style helps. Also, I've many times had to SSH
into a server and change HTML or PHP code in the half-VIM that ships
with CentOS and Debian, which does not support syntax highlighting. So
the style has real-world advantages.
> Annotating end-braces is also very helpful for long conditionals. Vim
> can track start and stop braces, but when they span several screen
> pages, it can be a problem.
>
Yup!
> Likewise commenting code as you go is an excellent idea. 2:1 comments
> are a bit much; Linus Torvalds would kick your butt. But I often do this
> if I'm not exactly sure how I'm going to code something, but I know the
> rough logic of it. Lay out the conditionals, comment on what should
> happen within each code block, and then go back and fill in the blocks
> with actual code.
>
2:1 is excessive. I only comment where the code is not explicitly
clear, or at the beginning of each code block of a long if / elseif /
elseif chain. And I comment the close parenthesis to know what it
closed.
> It's also worth noting that sometimes code is hard to follow. And even
> if you're going to be the only one updating it, you may well forget the
> logic six months from now. Commenting allows you to recapture that logic
> more easily.
>
Yup!
> And then there's the PHP interpreter. If you make a syntax error, like
> failing to add an closing brace, the interpreter will tell you so. If
> you spend *enough* time coding, you can usually track down where your
> mistakes are relatively easily. If you've ever coded in C, the same is
> true for the C compiler. Its behavior is very very similar to that of
> the PHP interpreter. It's something you get used to over time as you
> code more and more. Also, what could be called "incremental coding" or
> "stepwise development" helps: Code a little. Run/compile. Code a little,
> run/compile. That way, errors are easier to catch than after you've
> written 5000 lines in a file.
>
Sometimes I have to touch a live site, in fact _most_ of the work I do
is for small accounts that don't have a test environment. I can often
write a test page with a security-by-obscurity filename, but relying
on the interpreter is a habit that I cannot afford.
--
Dotan Cohen
http://gibberish.co.il
http://what-is-what.com
--- End Message ---
--- Begin Message ---
This question will probably reveal my lacking knowledge of the
fundamentals, but I'm a go for it anyway:
When you use a $_SERVER variable, is a query made to the server to get
the information or is it just sitting in a variable all ready to go?
Reworded, is there any efficiency gained by storing the data in a
"local" variable if it's going to be used many times in the script?
My experience with jQuery has taught me to store $(objects) in local
variables if they're going to be used repeatedly because the DOM is
queried every time a jQuery object is generated, so I'm wondering if a
similar logic applies.
Example:
if ($_SERVER['SCRIPT_NAME'] == 'how.php')
// do stuff
if ($_SERVER['SCRIPT_NAME'] == 'why.php')
// do other stuff
vs.
$script_name = $_SERVER['SCRIPT_NAME'];
if ($script_name == 'how.php')
// do stuff
if ($script_name == 'why.php')
// do other stuff
Cheerios,
Marc
--- End Message ---
--- Begin Message ---
Marc,
$_SERVER is an array and it should have all the information. I do not know
the answer for the latter part of your query.
Regards,
Shreyas
On Thu, Feb 24, 2011 at 12:30 AM, Marc Guay <[email protected]> wrote:
> This question will probably reveal my lacking knowledge of the
> fundamentals, but I'm a go for it anyway:
>
> When you use a $_SERVER variable, is a query made to the server to get
> the information or is it just sitting in a variable all ready to go?
> Reworded, is there any efficiency gained by storing the data in a
> "local" variable if it's going to be used many times in the script?
> My experience with jQuery has taught me to store $(objects) in local
> variables if they're going to be used repeatedly because the DOM is
> queried every time a jQuery object is generated, so I'm wondering if a
> similar logic applies.
>
> Example:
>
> if ($_SERVER['SCRIPT_NAME'] == 'how.php')
> // do stuff
> if ($_SERVER['SCRIPT_NAME'] == 'why.php')
> // do other stuff
>
> vs.
>
> $script_name = $_SERVER['SCRIPT_NAME'];
>
> if ($script_name == 'how.php')
> // do stuff
> if ($script_name == 'why.php')
> // do other stuff
>
> Cheerios,
> Marc
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Regards,
Shreyas Agasthya
--- End Message ---
--- Begin Message ---
On Wed, Feb 23, 2011 at 14:00, Marc Guay <[email protected]> wrote:
> This question will probably reveal my lacking knowledge of the
> fundamentals, but I'm a go for it anyway:
>
> When you use a $_SERVER variable, is a query made to the server to get
> the information or is it just sitting in a variable all ready to go?
> Reworded, is there any efficiency gained by storing the data in a
> "local" variable if it's going to be used many times in the script?
> My experience with jQuery has taught me to store $(objects) in local
> variables if they're going to be used repeatedly because the DOM is
> queried every time a jQuery object is generated, so I'm wondering if a
> similar logic applies.
$_SERVER is just a prepopulated superglobal array that is created
at runtime. When the script is executed via the web, PHP and the web
server (for example, Apache) generate numerous environment values as
directed by their configuration.
The quickest way to learn about this in more detail is to use it's
nickname in Google: EGPCS. The actual configuration directive is
variables_order, but many folks - particularly the PHP3/4 and very
early PHP5 - will be more familiar with the nickname, which is an
acronym for the default order of superglobals: Environment, Get, Post,
Cookie, Server.
--
</Daniel P. Brown>
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/
--- End Message ---
--- Begin Message ---
> $_SERVER is just a prepopulated superglobal array that is created at
> runtime.
Thanks for the clear answer.
Marc
--- End Message ---
--- Begin Message ---
> so when
> you're using $_SERVER variables there's no call back to the server, as the
> code is still being run on the server at that point.
This is something I actually do understand. I was wondering if the
code running on the server had to query the server for the information
every time a $_SERVER var was referenced, but like Daniel explained,
the contents of the $_SERVER array are populated at runtime and so no
further "hey server, what version of apache are you running?"
questions need to be asked of it.
Marc
--- End Message ---
--- Begin Message ---
Hi.
> Wrong catch? [1]
>
> Regards,
> Tommy
No, it wasn't. If you look at where I pass in parameters, I have a
$parameter-> value bound as value of the parameter, which is wrong. It
should be just $parameter. I corrected my code (after digging for the
larger part of a week), and now it's working. I guess this had to do
with my very short-lived experience with PHP - less than 40 hours, if
I put everything ever spent on PHP together.
br,
flj
--
Fine counsel is confusing, but example is always clear. (Edgar A.
Guest, The Light of Faith)
--- End Message ---
--- Begin Message ---
Is there a way to make this syntax:
$checking_answer = $answer_reference_2;
Equal to:
$checking_answer = $answer_reference_ . ($i + 1);
(where $i = 1)
making $checking_answer take on the value of $answer_reference_2 ?
I am trying to develop a web app quiz and I need to test the users answers.
Ron
The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info
--- End Message ---