|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
php-general Digest 25 Jul 2003 08:24:13 -0000 Issue 2196
php-general-digest-help
lists.php.net
Date: Fri Jul 25 2003 - 03:24:13 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
php-general Digest 25 Jul 2003 08:24:13 -0000 Issue 2196
Topics (messages 156738 through 156806):
Re: Include Problems
156738 by: Eric Fleming
fwrite int or float
156739 by: Ted Huntington
156747 by: Ted Huntington
156749 by: Ted Huntington
156769 by: Ted Huntington
156788 by: Curt Zirzow
Re: PHP Webpage like MySql- need to be able to see all fields and edit
156740 by: Bobby Patel
Re: arguments against moving site from Linux/Apache/PHP server to Windows/IIS/PHP needed
156741 by: Jim McNeely
156742 by: Chris W. Parker
156745 by: Chris Shiflett
156748 by: Roger B.A Klorese
156771 by: Tom Rogers
156802 by: Joel Rees
156804 by: Curt Zirzow
Display Records (brief summary and full details)
156743 by: Pushpinder Singh Garcha
156770 by: Tom Rogers
Re: PHP webpage like MySQL, PART 2
156744 by: Bobby Patel
156778 by: Jeff Harris
Regexp (ereg) help
156746 by: Reuben D. Budiardja
156791 by: Curt Zirzow
creating search
156750 by: Ryan A
cookies in asp
156751 by: Carlos Castillo
156760 by: Baroiller Pierre-Emmanuel
156766 by: John W. Holmes
PHP should know my data!
156752 by: John Manko
156753 by: Chris W. Parker
156754 by: Roger B.A Klorese
156755 by: Lars Torben Wilson
156756 by: Bobby Patel
156757 by: Chris Hubbard
156758 by: Robert Cummings
156759 by: John Manko
156761 by: Chris Hubbard
156762 by: Lars Torben Wilson
156776 by: J. Cox
156777 by: David Smith
156781 by: Chris Hubbard
Link acting as a submit button
156763 by: Matt Palermo
156773 by: DvDmanDT
156780 by: Matt Palermo
156787 by: Jeff Harris
156798 by: Curt Zirzow
File upload?
156764 by: Jonas
156767 by: Jonas
156768 by: Jennifer Goodie
Curl versus Fopen
156765 by: WL
ereg problem?
156772 by: chenqi1.zte.com.cn
156774 by: John W. Holmes
156794 by: Curt Zirzow
Re: classes v. functions
156775 by: Joel Rees
Re: I'm really getting annoyed with PHP
156779 by: Ow Mun Heng
Re: Same pattern, ereg_replace catches it, ereg doesn't
156782 by: Curt Zirzow
Re: PHP Upgrade Problem
156783 by: Curt Zirzow
156801 by: Tassos T
Include(remote HTML file) doesn't work since upgrade
156784 by: Police Trainee
156795 by: Curt Zirzow
156800 by: Police Trainee
Re: ARRAY QUESTION
156785 by: Curt Zirzow
Sorting algorithm(s) used by PHP's sort function
156786 by: Shaunak Kashyap
156799 by: Curt Zirzow
help with explode.....
156789 by: Joe Harman
156790 by: Joe Harman
156793 by: Binay Agarwal
156796 by: Joe Harman
156797 by: Joe Harman
Re: Load in a dedicated server
156792 by: desa15.necso.es
Re: Redirection Question (I spoke to soon)
156803 by: Joel Rees
cms design & xml-php ?
156805 by: Thomas Hochstetter
Thank you everyone
156806 by: Brenton Dobell
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscribe
lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscribe
lists.php.net
To post to the list, e-mail:
php-general
lists.php.net
----------------------------------------------------------------------
attached mail follows:
I figured out what was wrong with it, thanks for all your help. I hate
syntax errors. I needed to echo the variable when trying to display it and
the double "=" helped resolve the other problem. Thanks everyone.
"Chris W. Parker" <cparker
swatgear.com> wrote in message
news:001BD19C96E6E64E8750D72C2EA0ECEE2B7DED
ati-ex-01.ati.local...
Jay Blanchard <mailto:jay.blanchard
niicommunications.com>
on Thursday, July 24, 2003 1:12 PM said:
> I just cleaned it up some, used non deprecated formatting tags and sis
> it all in one shot.
Yeah but Jay, you didn't allow for an else. Your code should have an
else in there so that even if he's not at home it'll still print the
link, just not bold. ;)
Also, a ternary operator would be best for this.
echo ($subnav == "home") ? "<strong><a...>Home</a></strong>" :
"<a...>Home</a>";
Chris.
attached mail follows:
Is there some easy way to fwrite a 32 bit int or float?
--
Ted Huntington
Programmer Analyst I
Main Library
University of California, Irvine
PO Box 19557
Irvine, CA 92623-9557
Phone Bus Off 949 824 8926
Phone MRC 949 824 1674
emesg: thunting
uci.edu
webpage: http://business.lib.uci.edu/webpages/ted.htm
"Stop violence, teach science."
attached mail follows:
ok I see to use the "pack" command, but now how do I format to 32 bit
little endian?
Ted Huntington wrote:
> Is there some easy way to fwrite a 32 bit int or float?
>
> --
> Ted Huntington
> Programmer Analyst I
> Main Library
> University of California, Irvine
> PO Box 19557
> Irvine, CA 92623-9557
>
> Phone Bus Off 949 824 8926
> Phone MRC 949 824 1674
> emesg: thunting
uci.edu
> webpage: http://business.lib.uci.edu/webpages/ted.htm
> "Stop violence, teach science."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Ted Huntington
Programmer Analyst I
Main Library
University of California, Irvine
PO Box 19557
Irvine, CA 92623-9557
Phone Bus Off 949 824 8926
Phone MRC 949 824 1674
emesg: thunting
uci.edu
webpage: http://business.lib.uci.edu/webpages/ted.htm
"Stop violence, teach science."
attached mail follows:
I should have type "signed 32 bit little endian" and little endian float.
Ted Huntington wrote:
> ok I see to use the "pack" command, but now how do I format to 32 bit
> little endian?
>
> Ted Huntington wrote:
>
> > Is there some easy way to fwrite a 32 bit int or float?
> >
> > --
> > Ted Huntington
> > Programmer Analyst I
> > Main Library
> > University of California, Irvine
> > PO Box 19557
> > Irvine, CA 92623-9557
> >
> > Phone Bus Off 949 824 8926
> > Phone MRC 949 824 1674
> > emesg: thunting
uci.edu
> > webpage: http://business.lib.uci.edu/webpages/ted.htm
> > "Stop violence, teach science."
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> Ted Huntington
> Programmer Analyst I
> Main Library
> University of California, Irvine
> PO Box 19557
> Irvine, CA 92623-9557
>
> Phone Bus Off 949 824 8926
> Phone MRC 949 824 1674
> emesg: thunting
uci.edu
> webpage: http://business.lib.uci.edu/webpages/ted.htm
> "Stop violence, teach science."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Ted Huntington
Programmer Analyst I
Main Library
University of California, Irvine
PO Box 19557
Irvine, CA 92623-9557
Phone Bus Off 949 824 8926
Phone MRC 949 824 1674
emesg: thunting
uci.edu
webpage: http://business.lib.uci.edu/webpages/ted.htm
"Stop violence, teach science."
attached mail follows:
I basically solved this problem of writing a 32 bit float in little endian on
a big endian computer using:
$num2=pack("f",$num);
fwrite($fp,$num2[3],1);
fwrite($fp,$num2[2],1);
fwrite($fp,$num2[1],1);
fwrite($fp,$num2[0],1);
for floating point (I am working on a UNIX [big endian] making a file for i86
[little endian]).
The more info, the better, perhaps some body else will search and find this
if ever the need.
Ted Huntington wrote:
> I should have type "signed 32 bit little endian" and little endian float.
>
> Ted Huntington wrote:
>
> > ok I see to use the "pack" command, but now how do I format to 32 bit
> > little endian?
> >
> > Ted Huntington wrote:
> >
> > > Is there some easy way to fwrite a 32 bit int or float?
> > >
> > > --
> > > Ted Huntington
> > > Programmer Analyst I
> > > Main Library
> > > University of California, Irvine
> > > PO Box 19557
> > > Irvine, CA 92623-9557
> > >
> > > Phone Bus Off 949 824 8926
> > > Phone MRC 949 824 1674
> > > emesg: thunting
uci.edu
> > > webpage: http://business.lib.uci.edu/webpages/ted.htm
> > > "Stop violence, teach science."
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > --
> > Ted Huntington
> > Programmer Analyst I
> > Main Library
> > University of California, Irvine
> > PO Box 19557
> > Irvine, CA 92623-9557
> >
> > Phone Bus Off 949 824 8926
> > Phone MRC 949 824 1674
> > emesg: thunting
uci.edu
> > webpage: http://business.lib.uci.edu/webpages/ted.htm
> > "Stop violence, teach science."
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> Ted Huntington
> Programmer Analyst I
> Main Library
> University of California, Irvine
> PO Box 19557
> Irvine, CA 92623-9557
>
> Phone Bus Off 949 824 8926
> Phone MRC 949 824 1674
> emesg: thunting
uci.edu
> webpage: http://business.lib.uci.edu/webpages/ted.htm
> "Stop violence, teach science."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--
Ted Huntington
Programmer Analyst I
Main Library
University of California, Irvine
PO Box 19557
Irvine, CA 92623-9557
Phone Bus Off 949 824 8926
Phone MRC 949 824 1674
emesg: thunting
uci.edu
webpage: http://business.lib.uci.edu/webpages/ted.htm
"Stop violence, teach science."
attached mail follows:
* Thus wrote Ted Huntington (thunting
uci.edu):
> I basically solved this problem of writing a 32 bit float in little endian on
> a big endian computer using:
> $num2=pack("f",$num);
> fwrite($fp,$num2[3],1);
> fwrite($fp,$num2[2],1);
> fwrite($fp,$num2[1],1);
> fwrite($fp,$num2[0],1);
>
> for floating point (I am working on a UNIX [big endian] making a file for i86
> [little endian]).
>
> The more info, the better, perhaps some body else will search and find this
> if ever the need.
There was a large discussion on this about two weeks ago, check the
archives on 'big endian'
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
You could look at a nice GUI package that does all the database
modifications , its called phpMyAdmin (www.phpmyadmin.net).
But maybe this is too extrememe to what you want.
"Matt Hedges" < wrote in message
news:20030724153932.89185.qmail
pb1.pair.com...
> Hello. I am building a webpage for a sorority- http://www.olemissaoii.com
.
>
> I built a basic php script where they add the sisters and their names,
grad.
> date, and email. Is there anyway to build a page that shows all the
fields
> where someone could go in and edit/add what they need? What I basically
> want is a webpage that works like MyCC SQL Database. The only thing I've
> been able to figure out is a basic update page, but using that they have
to
> type in everything again- so for example if they want to change the email
> address, they'd have to retype the names and grad. date. So I'd like a
> script that shows all the rows and columns and allows someone to go in and
> change whatever field they want.
>
> Any help greatly appreciated,
> Hedges
>
>
>
>
> --
> ___________________________
> | Matt Hedges
> | http://hedgesinnovations.com
> |
>
>
attached mail follows:
If you have to move to Windows, at least use Apache. I note in my
server access logs on my Windows test machine that people are trying to
hack in every day and I have a very obscure site just to test my own
clients' web apps. It always looks like some kind of super long url
trying to do some kind of vbscript or something. Apache of course just
spits it right out. I can't even IMAGINE having a real IIS machine open
to the internet for a real site. Its just not done. Don't let them, you
are their last hope; they know not what they do!
Which opens to the notion that Apache isn't really meant for windows,
and Linux or OS X or BSD or ANY unix is simply more stable and secure.
It makes business sense to use them because over the long haul you are
going to spend less time cleaning up after hackers, less time cleaning
up after crashes, etc. It is pure lunacy to go from a successful linux
site to a windows IIS site. It will not be as successful.
That said, with my low volume site, apache on windows server 2003 and
even win XP professional have run very nicely. That might be a nice
compromise for them.
HTH
Jim McNeely
Envision Data
Custom, intuitive, practical software for your business.
jim
envisiondata.com
http://www.envisiondata.com
(940)383-0907
On Wednesday, July 23, 2003, at 02:13 PM, Chris W. Parker wrote:
> Chris Shiflett <mailto:shiflett
php.net>
> on Wednesday, July 23, 2003 8:27 AM said:
>
>> ...the Gartner
>> Group (suits typically respect their opinion) has recommended that it
>> not be used in production
>> (http://www3.gartner.com/DisplayDocument?doc_cd=101034).
>
> Interesting.
>
>> If you receive pressure to move away from Linux (a server OS) to
>> Windows (a desktop OS) for use as a server
>
> References? AFAIK, this is not true.
>
> Win2k server and up (advanced server, datacenter server) are meant for
> high availability, especially datacenter server.
>
>
>
> Chris.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
Jim McNeely <mailto:jim
envisiondata.com>
on Thursday, July 24, 2003 1:57 PM said:
> If you have to move to Windows, at least use Apache. I note in my
> server access logs on my Windows test machine that people are trying
> to hack in every day and I have a very obscure site just to test my
> own clients' web apps. It always looks like some kind of super long
> url trying to do some kind of vbscript or something.
Most likely no one is specifically targeting your machine. Everyone gets
these requests every day.
What's happening is that lots of IIS computers are still infected with
Nimda, Code Red, and SQL Server worms. Those computers have programs on
them that send out their mailicious URL's to random IP addresses in
hopes that one of those IP addresses will be home to an unpatched IIS
server.
If you ever use IIS you can get a tool (free) from MS called URLScan.
It's sort of like mod_rewrite in that it rejects all those strange
requests before they even get to IIS. Good tool. It's meant to only
allow well formed, valid http requests.
hth,
Chris.
attached mail follows:
--- "Chris W. Parker" <cparker
swatgear.com> wrote:
> If you ever use IIS you can get a tool (free) from MS called URLScan.
> It's sort of like mod_rewrite in that it rejects all those strange
> requests before they even get to IIS. Good tool. It's meant to only
> allow well formed, valid http requests.
That is so funny! :-)
I thought that's what the Web server was supposed to do.
Chris
=====
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
attached mail follows:
> From: Chris Shiflett [mailto:shiflett
php.net]
> Sent: Thursday, July 24, 2003 2:22 PM
>
> I thought that's what the Web server was supposed to do.
Well, that flies in the face of the filter-pipeline model, doesn't it? One
program, one job.
The web server should do the right thing in the face of a malformed request.
The idea that something blocks malformed requests from reaching the web
server isn't a bad one at all. It ought to be an unnecessary one, but
that's different.
attached mail follows:
Hi,
Friday, July 25, 2003, 7:21:32 AM, you wrote:
CS> --- "Chris W. Parker" <cparker
swatgear.com> wrote:
>> If you ever use IIS you can get a tool (free) from MS called URLScan.
>> It's sort of like mod_rewrite in that it rejects all those strange
>> requests before they even get to IIS. Good tool. It's meant to only
>> allow well formed, valid http requests.
CS> That is so funny! :-)
CS> I thought that's what the Web server was supposed to do.
CS> Chris
CS> =====
CS> Become a better Web developer with the HTTP Developer's Handbook
CS> http://httphandbook.org/
Where can I download the patch that fixes URLScan vulnerability :-)?
--
regards,
Tom
attached mail follows:
> First of all, security.. Windows is full of security holes
Did anyone mention the weak password encryption that cnet.com talked
about recently? If you get a copy of the password file, you can break
any MSW password in a few seconds. Macintosh passwords takes 4000 times
as long (or 4000 times as much memory). And Microsoft saying "Well, we
don't think it's a problem." or something like that.
At any rate, check the advisory lists, break them down by platform for
management. Make sure they don't overlook Mac OS X Server and openBSD.
Do some research -- the research your management is most likely to
understand is research that is done in house.
--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp
attached mail follows:
* Thus wrote Joel Rees (joel
alpsgiken.gr.jp):
> > First of all, security.. Windows is full of security holes
>
> Did anyone mention the weak password encryption that cnet.com talked
> about recently? If you get a copy of the password file, you can break
> any MSW password in a few seconds. Macintosh passwords takes 4000 times
I can see it already....
"But Sir, if we do it like this it will make password easily..."
"Screw it", Says the Marketer/Manager/Head of sales, "we have more
important things to do." And slaps down a piece of paper marked in
big red ink "URGENT" over some barely legible small print that says
"Network security exploit: unable to implement BSD's tcp stack
properly"
...Meanwhile, another VIP type person is on his way to the poor
programmers desk with a stack of papers tainted with RED ink.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Hello All,
I am trying to create a small MySQL application using PHP. I have a
table of contacts with each record having over 30 fields. I have a
search page where a logged-in admin can search for a particular record
on the basis of certain parameters.
This is a sample code:
$sql1 = "SELECT * from `contacts` WHERE $where";
while ($row = mysql_fetch_array($result1)) {
// Alternate the bgcolor of each row for visibility
($even % 2) == 0 ? $bgcolor = "#EFEFEF" : $bgcolor =
"#eeffff";
$even = $even + 1;
// print the actual row
echo "<TR BGCOLOR=$bgcolor>
<TD align=\"left\"><font color=\"#666666\" size=\"1\"
face=\"Verdana, Arial, Helvetica, sans-serif\">$row[company]</font></TD>
<TD align=\"left\"><font color=\"#666666\" size=\"1\"
face=\"Verdana, Arial, Helvetica, sans-serif\">$row[name_1]</font></TD>
<TD align=\"left\"><font color=\"#666666\" size=\"1\"
face=\"Verdana, Arial, Helvetica, sans-serif\">$row[phone_1]</font></TD>
<TD align=\"left\"><font color=\"#666666\" size=\"1\"
face=\"Verdana, Arial, Helvetica, sans-serif\">$row[city]</font></TD>
<TD align=\"left\"><font color=\"#666666\" size=\"1\"
face=\"Verdana, Arial, Helvetica, sans-serif\">$row[url]</font></TD>
<TD align=\"left\"><font color=\"#666666\" size=\"1\"
face=\"Verdana, Arial, Helvetica, sans-serif\">$row[email_1]</font></TD>
<TD align=\"center\"><font color=\"#333333\" size=\"1\"
face=\"Verdana, Arial, Helvetica, sans-serif\"><a
href=\"profile.php\">Link</a></font></TD>
</TR>";
// try to register the variable
$_SESSION['link'] = $row[company];
} // end while
// print the end of the table
echo "</TABLE></body></html>";
The above tables displays the results of the query in a table form
with only the main fields of the record. The last column of the table
contains a link to view the full-contents of the record. when the user
clicks this link, he will go to another script called
"profile.php" which will display all the contents of the record. In
order to do this I will need to store all the primary keys (in this
case the name of the company) of each record from the result set and
then use it to retrieve all the contents. I have been successful in
trying to do this for a single row (record) of the result by
registering it as an session variable called ['link']
I am at a loss to figure out how to store the names of the first column
of the result set i.e. the company name. Is it possible to create an
array of the session variable ['link'] ?? Another approach would be
to get the names of the companies as a separate query and register them
as an array of session variables.
any suggestions will be welcome. Thanks in advance.
--Pushpinder
attached mail follows:
Hi,
Friday, July 25, 2003, 7:13:27 AM, you wrote:
PSG> Hello All,
PSG> I am trying to create a small MySQL application using PHP. I have a
PSG> table of contacts with each record having over 30 fields. I have a
PSG> search page where a logged-in admin can search for a particular record
PSG> on the basis of certain parameters.
PSG> This is a sample code:
PSG> $sql1 = "SELECT * from `contacts` WHERE $where";
PSG> while ($row = mysql_fetch_array($result1)) {
PSG> // Alternate the bgcolor of each row for visibility
PSG> ($even % 2) == 0 ? $bgcolor = "#EFEFEF" : $bgcolor =
PSG> "#eeffff";
PSG> $even = $even + 1;
PSG> // print the actual row
PSG> echo "<TR BGCOLOR=$bgcolor>
PSG> <TD align=\"left\"><font color=\"#666666\" size=\"1\"
PSG> face=\"Verdana, Arial, Helvetica, sans-serif\">$row[company]</font></TD>
PSG> <TD align=\"left\"><font color=\"#666666\" size=\"1\"
PSG> face=\"Verdana, Arial, Helvetica, sans-serif\">$row[name_1]</font></TD>
PSG> <TD align=\"left\"><font color=\"#666666\" size=\"1\"
PSG> face=\"Verdana, Arial, Helvetica, sans-serif\">$row[phone_1]</font></TD>
PSG> <TD align=\"left\"><font color=\"#666666\" size=\"1\"
PSG> face=\"Verdana, Arial, Helvetica, sans-serif\">$row[city]</font></TD>
PSG> <TD align=\"left\"><font color=\"#666666\" size=\"1\"
PSG> face=\"Verdana, Arial, Helvetica, sans-serif\">$row[url]</font></TD>
PSG> <TD align=\"left\"><font color=\"#666666\" size=\"1\"
PSG> face=\"Verdana, Arial, Helvetica, sans-serif\">$row[email_1]</font></TD>
PSG> <TD align=\"center\"><font color=\"#333333\" size=\"1\"
PSG> face=\"Verdana, Arial, Helvetica, sans-serif\"><a
PSG> href=\"profile.php\">Link</a></font></TD>
PSG> </TR>";
PSG> // try to register the variable
PSG> $_SESSION['link'] = $row[company];
PSG> } // end while
PSG> // print the end of the table
PSG> echo "</TABLE></body></html>";
PSG> The above tables displays the results of the query in a table form
PSG> with only the main fields of the record. The last column of the table
PSG> contains a link to view the full-contents of the record. when the user
PSG> clicks this link, he will go to another script called
PSG> "profile.php" which will display all the contents of the record. In
PSG> order to do this I will need to store all the primary keys (in this
PSG> case the name of the company) of each record from the result set and
PSG> then use it to retrieve all the contents. I have been successful in
PSG> trying to do this for a single row (record) of the result by
PSG> registering it as an session variable called ['link']
PSG> I am at a loss to figure out how to store the names of the first column
PSG> of the result set i.e. the company name. Is it possible to create an
PSG> array of the session variable ['link'] ?? Another approach would be
PSG> to get the names of the companies as a separate query and register them
PSG> as an array of session variables.
PSG> any suggestions will be welcome. Thanks in advance.
PSG> --Pushpinder
in the href put
...<a href=\"profile.php?name=".$row['name']."\">...
Make a seperate array as you loop
$companies[$row['name']] = $row;
in your session store it as
$_SESSION['link'] = $companies;
You can then access it in profile php as
$details = $_SESSION['link']['$_GET['name']]
--
regards,
Tom
attached mail follows:
Are you talking about editing mutiple rows at the same time?
if so there is no efficient way to check what row has been edited and which
haven't. What I would is use HTML variable arrays for the names of the
fields.
example you have <input type='text' name='FirstName' size='20'
maxlength='20' value='Allison' > change the name attribute to name =
[data][$id][FirstName], so now you have all variables grouped (note the use
if a fixed index 'data', explination in foreach loop ). Then your script
will loop through the POST variables and do sequential UPDATES
example
foreach ($_POST[data] as $ID => $Field) {
$query = " Update tablename Set First = '$Field[FirstName'], Last =
'$Field[LastName'], .... Where id = $ID"; #List all fields in the set clause
mysql_query($query);
}
The reason for the initial 'data' index is so you can safely loop through a
cetrain part of the post array. If you left that out you would deal with
extra variables like submit, and other hidden fields.
It's a little hard to work with multi-dimensional arrays, so what I usually
do to help me is use the var_dump() on the passed POST array.
So take a look at var_dimp(), HTML with array indexes, the foreach loop
construct.
HOWEVER, if you need to just let the user edit 1 row, what you have is fine
all you have to do is pass the id number thourgh a HTML hidden field. So
when you pull the rest of the fields and spitting out HTML spit this out
somewhere in between the <form> tags :: <input type='hidden' name='id'
value='$id' >
Bobby
"Matt Hedges" <matt
hedges.org> wrote in message
news:20030724202124.43947.qmail
pb1.pair.com...
> Many hanks for ya'lls help earlier.
>
> I've figured out how to pull the data and edit it:
> http://www.hedges.org/aoii/olemiss/updatesister.php
>
> However, for some reason I can't get it to edit whatever row. In the code
> (pasted below) I have to specificy $id=row to edit...
>
> I can't figure out how to make it to where the user can select the field
> (which is the id/row) and edit it. I've tried putting a ?id=# at the end
of
> the url, but that doesn't work... Any thoughts? So what I want is where
it
> says
>
> $id=1
>
> to have it someway where that is a variable that the user can define...
>
>
>
>
> Thank you.
> Matt
>
>
>
> --
> ___________________________
> | Matt Hedges
> | http://hedgesinnovations.com
> |
>
>
attached mail follows:
On Jul 24, 2003, "Matt Hedges" claimed that:
|Many hanks for ya'lls help earlier.
|
|I've figured out how to pull the data and edit it:
|http://www.hedges.org/aoii/olemiss/updatesister.php
|
|However, for some reason I can't get it to edit whatever row. In the code
|(pasted below) I have to specificy $id=row to edit...
|
|I can't figure out how to make it to where the user can select the field
|(which is the id/row) and edit it. I've tried putting a ?id=# at the end of
|the url, but that doesn't work... Any thoughts? So what I want is where it
|says
|
|$id=1
|
|to have it someway where that is a variable that the user can define...
[some code snipped]
| else
| {
| $query = "SELECT * FROM table WHERE id='$id'";
| $result = mysql_query($query)
| or die ("Couldn't execute query.");
| $row = mysql_fetch_array($result);
| extract($row);
| }
|
|Thank you.
|Matt
|
Your page gives me "Warning: extract() expects first argument to be an
array in /c36/mhedges/aoii/olemiss/updatesister.php on line 32." Are you
sure you're using the correct table name? BTW, "table" is a MySQL
reserved keyword, so if it is the table name, it should be enclosed in
backticks: http://www.mysql.com/doc/en/Reserved_words.html
Jeff Harris
--
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.
attached mail follows:
Hi all,
If I have the following string:
$str = "This is a %ANS[1] test, and %ANS[2] test, and %ANS[10], test"
and want to use
ereg($pattern, $str, $regs);
what is the $pattern should be so that in $regs I have
$regs[1] == "%ANS[1]";
$regs[2] == "%ANS[2]";
$regs[3] == "%ANS[10]";
...
In fact, the $pattern should general enough that $regs will be filled with
anything that has the pattern
%ANS[X]
where X could be any number in any digits (eg. 1,2,10,100,23, etc).
Thanks for any help.
RDB
--
-------------------------------------------------
/"\ ASCII Ribbon Campaign against HTML
\ / email and proprietary format
X attachments.
/ \
-------------------------------------------------
Have you been used by Microsoft today?
Choose your life. Choose freedom.
Choose LINUX.
-------------------------------------------------
attached mail follows:
* Thus wrote Reuben D. Budiardja (reubendb
innovativethought.com):
>
> Hi all,
> If I have the following string:
> $str = "This is a %ANS[1] test, and %ANS[2] test, and %ANS[10], test"
>
> and want to use
> ereg($pattern, $str, $regs);
>
> what is the $pattern should be so that in $regs I have
>
> $regs[1] == "%ANS[1]";
> $regs[2] == "%ANS[2]";
> $regs[3] == "%ANS[10]";
> ...
Didn't I just reply to this :)
>
> In fact, the $pattern should general enough that $regs will be filled with
> anything that has the pattern
> %ANS[X]
>
> where X could be any number in any digits (eg. 1,2,10,100,23, etc).
Oh, now your making it more complicated..
preg_match_all('/(%ANS\[[0-9]+\])/', $str, $matches);
And is tested:
http://zirzow.dyndns.org/php/preg_match_all/test.php
btw, I am now a ereg* => preg* convert!
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Hi everyone,
I think i have read about this on the list before...or someone i'm sure must
have had the same problem.
I have a couple of tables, some with pretty large amount of fields (48 or
more) is there anyway to automatically create search forms after looking at
the database? or anyone have any ideas?
Cheers,
-Ryan
attached mail follows:
HI,
I have the following problem, i have a website with php and asp files, in
one asp file i create some cookie that i need to access on another php
file.....do you have any idea.....???
Thanks,
Carlos A. Castillo.
Ingeniero de desarrollo
<mailto:ccastillo
imagine.com.co> ccastillo
imagine.com.co
____________________________________
Su Aliado Efectivo en Internet
<http://www.imagine.com.co/> www.imagine.com.co
(57 1)2182064 - (57 1)6163218
Bogotá - Colombia
____________________________________
- Soluciones web para Internet e Intranet
- Soluciones para redes
- Licenciamiento de Software
- Asesoría y Soporte Técnico
____________________________________
attached mail follows:
If it's a real cookie, you can get it with php into the cookie vars..
If it's an asp session, forget it...
"Carlos Castillo" <ccastillo
imagine.com.co> a écrit dans le message de news:2081DA1102CFD6118ED20050DAD5D3452C21C8
intranet.imaginet.imagine.com.co...
HI,
I have the following problem, i have a website with php and asp files, in one asp file i create some cookie that i need to access on another php file.....do you have any idea.....???
Thanks,
Carlos A. Castillo.
Ingeniero de desarrollo
ccastillo
imagine.com.co
____________________________________
Su Aliado Efectivo en Internet
www.imagine.com.co
(57 1)2182064 - (57 1)6163218
Bogotá - Colombia
____________________________________
- Soluciones web para Internet e Intranet
- Soluciones para redes
- Licenciamiento de Software
- Asesoría y Soporte Técnico
____________________________________
attached mail follows:
Carlos Castillo wrote:
> HI,
>
> I have the following problem, i have a website with php and asp files, in
> one asp file i create some cookie that i need to access on another php
> file.....do you have any idea.....???
$_COOKIE['cookie_name']
Who cares where the cookie was made. If the page is on the same site,
it'll be sent the cookie. Next time try something before posting.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
attached mail follows:
I just wrote a web app, but I'm completely disgusted with PHP. The
application works great, but PHP is not smart enough to know what data
belongs in my database. Really, I have to enter the stuff in myself. I
spent 2 long days writing this (sweating and crying), and you mean to
tell me that it doesn't auto-populate my database information? Come on,
people! Data entry is the thing of the past! Maybe I'll convert my
codebase to COBOL or something. At least, it has proven experience with
user data! Sometimes I wonder how long this "innovative" technology
will last when there are incompetent languages like PHP, Perl, and
Java. Color me disappointed.
John Manko
IT Professional
attached mail follows:
John Manko <mailto:xerid
adelphia.net>
on Thursday, July 24, 2003 3:04 PM said:
> Sometimes I wonder how long this
> "innovative" technology will last when there are incompetent
> languages like PHP, Perl, and Java. Color me disappointed.
Color me ignorant, but what the heck are you talking about? I'd really
like to know it sounds interesting.
Chris.
attached mail follows:
> From: Chris W. Parker [mailto:cparker
swatgear.com]
> Sent: Thursday, July 24, 2003 3:07 PM
> To: John Manko; PHP General
> Subject: RE: [PHP] PHP should know my data!
>
>
> Color me ignorant...
Isn't "ignorant" the color they dropped from the rainbow? Red, Orange,
Yellow, Green, Blue, ignorant, violent?
attached mail follows:
On Thu, 2003-07-24 at 15:04, John Manko wrote:
> I just wrote a web app, but I'm completely disgusted with PHP. The
> application works great, but PHP is not smart enough to know what data
> belongs in my database. Really, I have to enter the stuff in myself. I
> spent 2 long days writing this (sweating and crying), and you mean to
> tell me that it doesn't auto-populate my database information? Come on,
> people! Data entry is the thing of the past! Maybe I'll convert my
> codebase to COBOL or something. At least, it has proven experience with
> user data! Sometimes I wonder how long this "innovative" technology
> will last when there are incompetent languages like PHP, Perl, and
> Java. Color me disappointed.
>
> John Manko
> IT Professional
I'm not sure what you mean that PHP should automatically know what goes
into the database, but if you post a detailed description of the
problem you're facing, chances are that someone (or several someones,
more likely) will provide suggestion to help you out.
Feel free to post details if you would like a hand with it.
--
Torben Wilson <torben
php.net> +1.604.709.0506
http://www.thebuttlesschaps.com http://www.inflatableeye.com
http://www.hybrid17.com http://www.themainonmain.com
-----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----
attached mail follows:
auto-populate data, as in putting in mock data depending on column type? or
transferring data from another data source.
If the former, you can look at 3rd party sources (I think I saw one from
winSQL), if the latter you can convert any data source to a (tab, comma,
etc.) delimeted file which you can load into MySQL through your own PHP
script or I'm sure there is some php script out there that loads in CVS
files.
"John Manko" <xerid
adelphia.net> wrote in message
news:3F2057DC.2030703
adelphia.net...
> I just wrote a web app, but I'm completely disgusted with PHP. The
> application works great, but PHP is not smart enough to know what data
> belongs in my database. Really, I have to enter the stuff in myself. I
> spent 2 long days writing this (sweating and crying), and you mean to
> tell me that it doesn't auto-populate my database information? Come on,
> people! Data entry is the thing of the past! Maybe I'll convert my
> codebase to COBOL or something. At least, it has proven experience with
> user data! Sometimes I wonder how long this "innovative" technology
> will last when there are incompetent languages like PHP, Perl, and
> Java. Color me disappointed.
>
> John Manko
> IT Professional
>
>
attached mail follows:
Now this is funny. John, you've captured the irony of a number of recent
posts. Congrats. Been a while since I laughed this hard. Cobol. egad.
That's a nice touch.
Thanks for the levity.
chris
-----Original Message-----
From: John Manko [mailto:xerid
adelphia.net]
Sent: Thursday, July 24, 2003 2:04 PM
To: PHP General
Subject: [PHP] PHP should know my data!
I just wrote a web app, but I'm completely disgusted with PHP. The
application works great, but PHP is not smart enough to know what data
belongs in my database. Really, I have to enter the stuff in myself. I
spent 2 long days writing this (sweating and crying), and you mean to
tell me that it doesn't auto-populate my database information? Come on,
people! Data entry is the thing of the past! Maybe I'll convert my
codebase to COBOL or something. At least, it has proven experience with
user data! Sometimes I wonder how long this "innovative" technology
will last when there are incompetent languages like PHP, Perl, and
Java. Color me disappointed.
John Manko
IT Professional
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
Unfortunately I don't think some people "got" the joke. Next thing you
know their going to complain that PHP should have told them the
punchline ;)
Cheers,
Rob.
On Thu, 2003-07-24 at 18:17, Chris Hubbard wrote:
> Now this is funny. John, you've captured the irony of a number of recent
> posts. Congrats. Been a while since I laughed this hard. Cobol. egad.
> That's a nice touch.
> Thanks for the levity.
> chris
>
>
> -----Original Message-----
> From: John Manko [mailto:xerid
adelphia.net]
> Sent: Thursday, July 24, 2003 2:04 PM
> To: PHP General
> Subject: [PHP] PHP should know my data!
>
>
> I just wrote a web app, but I'm completely disgusted with PHP. The
> application works great, but PHP is not smart enough to know what data
> belongs in my database. Really, I have to enter the stuff in myself. I
> spent 2 long days writing this (sweating and crying), and you mean to
> tell me that it doesn't auto-populate my database information? Come on,
> people! Data entry is the thing of the past! Maybe I'll convert my
> codebase to COBOL or something. At least, it has proven experience with
> user data! Sometimes I wonder how long this "innovative" technology
> will last when there are incompetent languages like PHP, Perl, and
> Java. Color me disappointed.
>
> John Manko
> IT Professional
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
attached mail follows:
LOL :) - Now that's funny!
Robert Cummings wrote:
>Unfortunately I don't think some people "got" the joke. Next thing you
>know their going to complain that PHP should have told them the
>punchline ;)
>
>Cheers,
>Rob.
>
>On Thu, 2003-07-24 at 18:17, Chris Hubbard wrote:
>
>
>>Now this is funny. John, you've captured the irony of a number of recent
>>posts. Congrats. Been a while since I laughed this hard. Cobol. egad.
>>That's a nice touch.
>>Thanks for the levity.
>>chris
>>
>>
>>-----Original Message-----
>>From: John Manko [mailto:xerid
adelphia.net]
>>Sent: Thursday, July 24, 2003 2:04 PM
>>To: PHP General
>>Subject: [PHP] PHP should know my data!
>>
>>
>>I just wrote a web app, but I'm completely disgusted with PHP. The
>>application works great, but PHP is not smart enough to know what data
>>belongs in my database. Really, I have to enter the stuff in myself. I
>>spent 2 long days writing this (sweating and crying), and you mean to
>>tell me that it doesn't auto-populate my database information? Come on,
>>people! Data entry is the thing of the past! Maybe I'll convert my
>>codebase to COBOL or something. At least, it has proven experience with
>>user data! Sometimes I wonder how long this "innovative" technology
>>will last when there are incompetent languages like PHP, Perl, and
>>Java. Color me disappointed.
>>
>>John Manko
>>IT Professional
>>
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>
>
>
>
>
attached mail follows:
Hmm. You're right. Maybe something like the following would help:
<?php
if ($_SESSION["irony"])
{
$rs = enjoyJoke($_POST["msg"])
}else{
$rs = fixProblem($_POST["msg"])
}
echo "<h3>". $rs ."</h3>";
?>
-----Original Message-----
From: Robert Cummings [mailto:robert
wocmud.org]
Sent: Thursday, July 24, 2003 2:24 PM
To: Chris Hubbard
Cc: John Manko; PHP General
Subject: RE: [PHP] PHP should know my data!
Unfortunately I don't think some people "got" the joke. Next thing you
know their going to complain that PHP should have told them the
punchline ;)
Cheers,
Rob.
On Thu, 2003-07-24 at 18:17, Chris Hubbard wrote:
> Now this is funny. John, you've captured the irony of a number of recent
> posts. Congrats. Been a while since I laughed this hard. Cobol. egad.
> That's a nice touch.
> Thanks for the levity.
> chris
>
>
> -----Original Message-----
> From: John Manko [mailto:xerid
adelphia.net]
> Sent: Thursday, July 24, 2003 2:04 PM
> To: PHP General
> Subject: [PHP] PHP should know my data!
>
>
> I just wrote a web app, but I'm completely disgusted with PHP. The
> application works great, but PHP is not smart enough to know what data
> belongs in my database. Really, I have to enter the stuff in myself. I
> spent 2 long days writing this (sweating and crying), and you mean to
> tell me that it doesn't auto-populate my database information? Come on,
> people! Data entry is the thing of the past! Maybe I'll convert my
> codebase to COBOL or something. At least, it has proven experience with
> user data! Sometimes I wonder how long this "innovative" technology
> will last when there are incompetent languages like PHP, Perl, and
> Java. Color me disappointed.
>
> John Manko
> IT Professional
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
On Thu, 2003-07-24 at 15:24, John Manko wrote:
> LOL :) - Now that's funny!
>
> Robert Cummings wrote:
>
> >Unfortunately I don't think some people "got" the joke. Next thing you
> >know their going to complain that PHP should have told them the
> >punchline ;)
> >
> >Cheers,
> >Rob.
Oh fer Pete's sake. lol--got me. The sad thing is that sometimes things
get to a point on the list where this sort of thing would seem likely...
--
Torben Wilson <torben
php.net> +1.604.709.0506
http://www.thebuttlesschaps.com http://www.inflatableeye.com
http://www.hybrid17.com http://www.themainonmain.com
-----==== Boycott Starbucks! http://www.haidabuckscafe.com ====-----
attached mail follows:
"Chris Hubbard" <chris
wildcharacters.com> wrote in message
news:AMEHIMKKMFIMCOJPPEEEGEENCBAA.chris
wildcharacters.com...
> Hmm. You're right. Maybe something like the following would help:
>
> <?php
> if ($_SESSION["irony"])
> {
> $rs = enjoyJoke($_POST["msg"])
> }else{
> $rs = fixProblem($_POST["msg"])
> }
> echo "<h3>". $rs ."</h3>";
>
> ?>
This isn't working in Windows. Anyone know why?
attached mail follows:
One possibility could be that your register_globals is off...maybe.
David
-----Original Message-----
From: news [mailto:news
main.gmane.org]On Behalf Of J. Cox
Sent: Thursday, July 24, 2003 8:26 PM
To: php-general
lists.php.net
Subject: [PHP] Re: PHP should know my data!
"Chris Hubbard" <chris
wildcharacters.com> wrote in message
news:AMEHIMKKMFIMCOJPPEEEGEENCBAA.chris
wildcharacters.com...
> Hmm. You're right. Maybe something like the following would help:
>
> <?php
> if ($_SESSION["irony"])
> {
> $rs = enjoyJoke($_POST["msg"])
> }else{
> $rs = fixProblem($_POST["msg"])
> }
> echo "<h3>". $rs ."</h3>";
>
> ?>
This isn't working in Windows. Anyone know why?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I wrote the code.
Here's what's wrong:
You probably have a misconfigured PHP.ini file (it's really common). You
need to set the variable in your php.ini file to false like this:
register_syntax_checking = "false";
That way PHP won't need to perform any syntax checking on the php code.
I've found that the PHP scripts are roughly 15 times faster.
Mind you, you really have to know what you're doing before you start editing
the php.ini file.
In fact I recommend that you don't change your php.ini file without backing
it up first.
and if you've gotten this far, then please don't change your php.ini file.
-----Original Message-----
From: David Smith [mailto:dsmith
sebc.edu]
Sent: Thursday, July 24, 2003 5:39 PM
To: php-general
lists.php.net
Subject: RE: [PHP] Re: PHP should know my data!
One possibility could be that your register_globals is off...maybe.
David
-----Original Message-----
From: news [mailto:news
main.gmane.org]On Behalf Of J. Cox
Sent: Thursday, July 24, 2003 8:26 PM
To: php-general
lists.php.net
Subject: [PHP] Re: PHP should know my data!
"Chris Hubbard" <chris
wildcharacters.com> wrote in message
news:AMEHIMKKMFIMCOJPPEEEGEENCBAA.chris
wildcharacters.com...
> Hmm. You're right. Maybe something like the following would help:
>
> <?php
> if ($_SESSION["irony"])
> {
> $rs = enjoyJoke($_POST["msg"])
> }else{
> $rs = fixProblem($_POST["msg"])
> }
> echo "<h3>". $rs ."</h3>";
>
> ?>
This isn't working in Windows. Anyone know why?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
attached mail follows:
I am trying to create a submit button out of a hyperlink using the
following
code:
(this is in a file called index.html)
<A href="javascript:go_where_my_variable_says('this.php');">this
page</a>
<SCRIPT LANGUAGE="JavaScript">
<!--
function go_where_my_variable_says(where)
{
document.forms[0].action = where;
document.forms[0].submit();
}
//-->
</SCRIPT>
This works fine as an html document, however, when I try to echo the
same code
out in a PHP page, it gives me javascript errors. I am using the
following to
echo it out in PHP:
echo "
<A href=\"javascript:go_where_my_variable_says('this.php');\">this
page</a>
<SCRIPT LANGUAGE=\"JavaScript\">
<!--
function go_where_my_variable_says(where)
{
document.forms[0].action = where;
document.forms[0].submit();
}
//-->
</SCRIPT>
";
This displays the link fine for the submit hyperlink, but it gives the
javascript error:
Error: Object doesn't support this property or method.
Code: 0
Like I said before, this code works perfectly fine if I have it an html
document.
Anyone got any ideas?
Thanks,
Matt
attached mail follows:
Warning for </SCRIPT>... It's also the ending for PHP you see... Shouldn't
matter in this case, although, wouldn't suprise me at all if it was...
--
// DvDmanDT
MSN: dvdmandt
hotmail.com
Mail: dvdmandt
telia.com
"Matt Palermo" <mpalermo
vt.edu> skrev i meddelandet
news:001001c35233$f6a89940$4400a8c0
laptop...
> I am trying to create a submit button out of a hyperlink using the
> following
> code:
>
> (this is in a file called index.html)
> <A href="javascript:go_where_my_variable_says('this.php');">this
> page</a>
>
>
> <SCRIPT LANGUAGE="JavaScript">
> <!--
> function go_where_my_variable_says(where)
> {
> document.forms[0].action = where;
> document.forms[0].submit();
> }
> //-->
> </SCRIPT>
>
> This works fine as an html document, however, when I try to echo the
> same code
> out in a PHP page, it gives me javascript errors. I am using the
> following to
> echo it out in PHP:
>
> echo "
> <A href=\"javascript:go_where_my_variable_says('this.php');\">this
> page</a>
>
>
> <SCRIPT LANGUAGE=\"JavaScript\">
> <!--
> function go_where_my_variable_says(where)
> {
> document.forms[0].action = where;
> document.forms[0].submit();
> }
> //-->
> </SCRIPT>
> ";
>
> This displays the link fine for the submit hyperlink, but it gives the
> javascript error:
>
> Error: Object doesn't support this property or method.
> Code: 0
>
> Like I said before, this code works perfectly fine if I have it an html
> document.
>
> Anyone got any ideas?
>
> Thanks,
> Matt
>
>
>
>
>
attached mail follows:
Fixing the javascript that you specified still gave me the same
errors... Got any more suggestions?
Thanks for your help,
Matt
-----Original Message-----
From: Jim Lucas [mailto:phplist
zonedzero.net]
Sent: Thursday, July 24, 2003 6:40 PM
To: Matt Palermo
Subject: Re: [PHP] Link acting as a submit button
Your javascript is wrong.
change this
document.forms[0].action = where;
to this
document.forms[0].action.value = where;
Jim Lucas
----- Original Message -----
From: "Matt Palermo" <mpalermo
vt.edu>
To: <php-general
lists.php.net>
Sent: Thursday, July 24, 2003 3:35 PM
Subject: [PHP] Link acting as a submit button
> I am trying to create a submit button out of a hyperlink using the
> following
> code:
>
> (this is in a file called index.html)
> <A href="javascript:go_where_my_variable_says('this.php');">this
> page</a>
>
>
> <SCRIPT LANGUAGE="JavaScript">
> <!--
> function go_where_my_variable_says(where)
> {
> document.forms[0].action = where;
> document.forms[0].submit();
> }
> //-->
> </SCRIPT>
>
> This works fine as an html document, however, when I try to echo the
> same code
> out in a PHP page, it gives me javascript errors. I am using the
> following to
> echo it out in PHP:
>
> echo "
> <A href=\"javascript:go_where_my_variable_says('this.php');\">this
> page</a>
>
>
> <SCRIPT LANGUAGE=\"JavaScript\">
> <!--
> function go_where_my_variable_says(where)
> {
> document.forms[0].action = where;
> document.forms[0].submit();
> }
> //-->
> </SCRIPT>
> ";
>
> This displays the link fine for the submit hyperlink, but it gives the
> javascript error:
>
> Error: Object doesn't support this property or method.
> Code: 0
>
> Like I said before, this code works perfectly fine if I have it an
html
> document.
>
> Anyone got any ideas?
>
> Thanks,
> Matt
>
>
>
>
>
attached mail follows:
|-----Original Message-----
|From: "Matt Palermo" <mpalermo
vt.edu>
|Sent: Thursday, July 24, 2003 3:35 PM
|
|> I am trying to create a submit button out of a hyperlink using the
|> following
|> code:
|>
|> (this is in a file called index.html)
|> <A DEFANGED_href="javascript:go_where_my_variable_says('this.php');">this
|> page</a>
|>
|> <DEFANGED_SCRIPT LANGUAGE="JavaScript">
|> <!--
|> function go_where_my_variable_says(where)
|> {
|> document.forms[0].action = where;
|> document.forms[0].submit();
|> }
|> //-->
|> </DEFANGED_SCRIPT>
|> This works fine as an html document, however, when I try to echo the
|> same code out in a PHP page, it gives me javascript errors. I am using
|> the following to echo it out in PHP:
|>
|> echo "
|> <A href=\"javascript:go_where_my_variable_says('this.php');\">this
|> page</a>
|>
|>
|> <DEFANGED_SCRIPT LANGUAGE=\"JavaScript\">
|> <!--
|> function go_where_my_variable_says(where)
|> {
|> document.forms[0].action = where;
|> document.forms[0].submit();
|> }
|> //-->
|> </DEFANGED_SCRIPT>
|> ";
|>
|> This displays the link fine for the submit hyperlink, but it gives the
|
|> javascript error:
|>
|> Error: Object doesn't support this property or method.
|> Code: 0
|> Like I said before, this code works perfectly fine if I have it an html
|> document.
|>
|> Anyone got any ideas?
|>
|> Thanks,
|> Matt
|
|From: Jim Lucas [mailto:phplist
zonedzero.net]
|Sent: Thursday, July 24, 2003 6:40 PM
|To: Matt Palermo
|Subject: Re: [PHP] Link acting as a submit button
|
|Your javascript is wrong.
|
|change this
| document.forms[0].action = where;
|to this
| document.forms[0].action.value = where;
|
|Jim Lucas
|
|----- Original Message -----
On Jul 24, 2003, "Matt Palermo" claimed that:
|Fixing the javascript that you specified still gave me the same
|errors... Got any more suggestions?
|
|Thanks for your help,
|
|Matt
When you converted it to PHP did you include the <form> tags? I received a
similar error until I added the <form> tags. Other than that, try adding a
name value to the form and change 'document.forms[0].action = where;' to
'document.form_name.action = where;'
Except for the fact that I don't have this.php, it appeared to work for me
after the addition of the form tags as posted.
Jeff
--
Registered Linux user #304026.
"lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import"
Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED
Responses to this message should conform to RFC 1855.
attached mail follows:
* Thus wrote Matt Palermo (mpalermo
vt.edu):
> I am trying to create a submit button out of a hyperlink using the
> following
> code:
>
> (this is in a file called index.html)
> <A href="javascript:go_where_my_variable_says('this.php');">this
> page</a>
>
>
> <SCRIPT LANGUAGE="JavaScript">
> <!--
> function go_where_my_variable_says(where)
> {
> document.forms[0].action = where;
> document.forms[0].submit();
> }
> //-->
> </SCRIPT>
>
> This works fine as an html document, however, when I try to echo the
> same code
> out in a PHP page, it gives me javascript errors. I am using the
> following to
> echo it out in PHP:
>
> echo "
> <A href=\"javascript:go_where_my_variable_says('this.php');\">this
> page</a>
>
>
> <SCRIPT LANGUAGE=\"JavaScript\">
> <!--
> function go_where_my_variable_says(where)
> {
> document.forms[0].action = where;
> document.forms[0].submit();
> }
> //-->
> </SCRIPT>
> ";
No need to echo out the statement, better to use this method so you
dont have to escape each and every " existing:
// leave php to output html ?>
<A href="javascript:go_where_my_variable_says('this.php');">this
page</a>
<SCRIPT LANGUAGE="JavaScript">
<!--
function go_where_my_variable_says(where)
{
document.forms[0].action = where;
document.forms[0].submit();
}
//-->
</SCRIPT>
<?php // now back in php mode
>
> This displays the link fine for the submit hyperlink, but it gives the
> javascript error:
>
> Error: Object doesn't support this property or method.
> Code: 0
>
> Like I said before, this code works perfectly fine if I have it an html
> document.
>
> Anyone got any ideas?
With that being said I dont see a php problem here.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Okay, I must be missing the totally obvious here...so if someone would be
able to help a poor newbie along the way I'd be most grateful.
The system I'm running this on is, in case it matters, WinXP with IIS 5.1 and
PHP 4.3.2.
Anyway, I'm trying to add a form to upload files on one of my pages. I only
have one small problem, which is when my script is trying to move the uploaded
file to its permanent place.
The relevant part of the script looks like this:
$uploaddir = 'C:\Inetpub\wwwroot\pix';
$filnamn=$_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir .
$filnamn)) {
print "File is valid, and was successfully uploaded.";
} else {
print "An error occured during upload.";
}
Now, this works partly. It uploads the file. However, it doesn't end up in the
directory called pix as I want it to. No, what happens is that the
file gets named with pix as the first part of the filename. Like if the
file is called pic1.jpg it ends up as C:\Inetpub\wwwroot\pixpic1.jpg
I thought of just adding a backslash at the very end of the $uploaddir
variable but that just leaves me with this error-message instead:
Parse error: parse error, unexpected T_STRING in
c:\inetpub\wwwroot\alterdb\upload2.php on line 25
Line 25 happens to be that $filnamn line you can see above.
I'm at a loss as to what could be the problem so any suggestions to where to
look?
Thanks in advance
--
/Jonas
attached mail follows:
Never mind. I found the problem. I was just stupid enough to forget about
escaping the backslash.
/Jonas
attached mail follows:
> $uploaddir = 'C:\Inetpub\wwwroot\pix';
> $filnamn=$_FILES['userfile']['name'];
> I thought of just adding a backslash at the very end of the $uploaddir
> variable but that just leaves me with this error-message instead:
>
> Parse error: parse error, unexpected T_STRING in
> c:\inetpub\wwwroot\alterdb\upload2.php on line 25
>
> Line 25 happens to be that $filnamn line you can see above.
>
> I'm at a loss as to what could be the problem so any suggestions
> to where to
> look?
>
Since a ' comes right after the \ it is escaping it. Instead escape the \
so it is interpreted as \ and not the escape character.
$uploaddir = 'C:\Inetpub\wwwroot\pix\\';
attached mail follows:
Hi.
I've had a lot of problems with Fopen on my hosters' Windows PHP
compilation. I've asked them to install Curl for PHP to see if I can modify
my scripts and get them working - have people had problems with Fopen, and
did Curl cure any of them for you?
Will
attached mail follows:
who can tell me what's the pattern string mean.
if(ereg("[\\][n]",$username))
{
/*Do err*/
}
attached mail follows:
chenqi1
zte.com.cn wrote:
> who can tell me what's the pattern string mean.
> if(ereg("[\\][n]",$username))
> {
> /*Do err*/
> }
It's looking for a \ character or a \ character followed by the letter n
anywhere within the string $username.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
PHP|Architect: A magazine for PHP Professionals – www.phparch.com
attached mail follows:
* Thus wrote John W. Holmes (holmes072000
charter.net):
> chenqi1
zte.com.cn wrote:
>
> >who can tell me what's the pattern string mean.
> >if(ereg("[\\][n]",$username))
> >{
> > /*Do err*/
> >}
>
> It's looking for a \ character or a \ character followed by the letter n
> anywhere within the string $username.
>
I hope that isn't looking for a Carriage Return, cause it never will...
Just in case it is.... strstr($username, "\n");
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
> Hi,
>
> am Wednesday 23 July 2003 11:48 schrieb Joel Rees:
>
> > (You know that $accesses->count and $accesses->resetCounter() are at
> > least declared in the same class declaration. $accesses_count and
> > accesses_resetCounter() could be declared in entirely unrelated include
> > files for entirely different purposes.)
>
> That is the only benefit. But it's not OOP. If you need namespaces and can't
> take care of them w/o misuse of a semi-OOP construct youre not any more
> efficient with it.
???? misuse? (I leaned sideways and cross my eyes, then I stood on my
head, but that still makes no sense.)
> >> Is there any performance benefit one way or the other?
> >
> > Programmer performance?
> >
> >> I used EZ_Sql which is cool but didn't seem to speed things up in
> >> comparison to the said include file.
> >> Still don't see the beef.
> >
> > Execution speed isn't all that matters. In fact, speed is not the point
> > at all.
>
> Then you must be an PHPNuke or Typo3-programmer, beeing lucky to get at
> least 1 request per second ;).
Oh, yeah, gotta watch those bees.
> Don't take it hard, but If you had ever been in computer-science
> [school|college|...] you would know that speed is all that matters.
Sure. ROFDDCI
--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp
Rate that troll, maybe a 4/10?
attached mail follows:
This thread's too long. I'm getting confused on who exactly asked the
question..
My Take on thi
/snip
what if the code logic requires that there is some output sent to the
browser.
/snip
In my case I use a Refresh-redirect. I've posted my code on this on this
thread. The way I'm doing it is like this.. (logic)
The header_refresh_html will redirect to "home.php" if user is already
logged in but not before issuing a warning to the user to logout before
logging in again.
The Error msg will be display WAY.. before the refresh/redirect takes place.
(2 seconds) Maybe if through the internet it's not so great,but on my
intranet, 2 secs is long enough for the user to view the message.
====login.php========
if ( check_if_authenticated() )
{
header_refresh_html("home.php");
trigger_error(ERROR_USER_ALREADY_AUTHENTICATED, WARNING);
exit;
}
else
{
//display login form/msg
}
=========================
Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia
DID : 03-7870 5168
-----Original Message-----
From: Pushpinder Singh Garcha [mailto:pgarcha
adelphia.net]
Sent: Friday, July 25, 2003 2:10 AM
To: Curt Zirzow
Cc: PHP
Subject: Re: [PHP] I'm really getting annoyed with PHP
hello everyone,
Can somebody tell me why meta-refresh is not preferred to do re-directs
?
I know Javascript is browser dependent, so its undependable.
using headers in php requires that no output is sent to the browser,
what if the code logic requires that there is some output sent to the
browser. I am sorry if this is a repeat question because someone
earlier did mention abt output buffering as a way around.
TIA
--Pushpinder
On Thursday, July 24, 2003, at 12:11 PM, Curt Zirzow wrote:
> * Thus wrote Pushpinder Singh Garcha (pgarcha
adelphia.net):
>> try this,
>>
>>
>> use a meta-refresh ...
>>
>> echo "<META HTTP-EQUIV=\"refresh\"
>> content=\"3;URL=http://wherever_u_wana_go.com/hello.html\">";
>
> This has already been discussed, and is not the preferred method of
> doing redirects. PHP can handle what he is doing just fine.
>
>
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not so sure."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
attached mail follows:
* Thus wrote Reuben D. Budiardja (reubendb
innovativethought.com):
>
> Hi all,
> My guess is I miss something really dumb, but here is my problem. I want to
> use ereg to find some pattern, but it doesn't seems to work. The same pattern
> uses with ereg_replace, works fine and replaced the pattern. Here is my code,
> and the output:
>
> <?
> $string = "This is a %ANS[1] test, and %ANS[2] test, and %ANS[10], test";
> echo "String is: $string\n";
>
> $pattern = "%ANS[[0-9]+]";
Should be:
'%ANS\[[0-9]+\]'
note also the single quote to avoid needing to avoid escaping the escape:
what you have i think would match:
%ANS9
or
%ANS+
I'm not sure how the nested character classes work with ereg.
Also I would look at the PCRE functions, they are in general faster
than the standard ereg* functions. Unless you require a POSIX
compatible script.
HTH,
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
* Thus wrote Shaun (shaun
mania.plus.com):
> Hi,
>
> The following code snippet is supposed to return the current page i am on
> and append some variables.
>
> $s = getenv('SCRIPT_NAME');
> $link = "$s?month=$month&year=$year&goto_date=yes";
>
> However, since upgrading to PHP version 4.3.2 it returns the following URL:
>
> execscriptdir/php.cgi?day=19&month=07&year=2003&goto_date=yes
>
> when it should be
>
> bookings.php?day=19&month=07&year=2003&goto_date=yes
>
> can anyone help please?
Hm..
so what kind of environment are you in CGI?
Is that the exact text that it is returning?
ie execscriptdir/php.cgi
Oh and one last quetion, have you tried using getenv('PHP_SELF')?
I'm not sure if PHP_SELF will make a difference, but i would try it
anyway.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
I thing, you must use
$s = getenv('SCRIPT_URL'); and not $s = getenv('SCRIPT_NAME'); in php ver 4.3.2
Shaun wrote:
>Hi,
>
>The following code snippet is supposed to return the current page i am on
>and append some variables.
>
>$s = getenv('SCRIPT_NAME');
>$link = "$s?month=$month&year=$year&goto_date=yes";
>
>However, since upgrading to PHP version 4.3.2 it returns the following URL:
>
>execscriptdir/php.cgi?day=19&month=07&year=2003&goto_date=yes
>
>when it should be
>
>bookings.php?day=19&month=07&year=2003&goto_date=yes
>
>can anyone help please?
>
>Thanks
>
>
>
>
>
>
>
attached mail follows:
When the server upgraded to php 4.3.1 from 4.2.x, I
was no longer able to include remote html files.
allow_url_fopen is still enabled and no other settings
have changed. Running Apache 1.3.27 on Linux.
This is one line that I use to call the remote html
file. It also has not changed since the upgrade:
<?include("http://143.43.222.103/sga");?>
This line worked before, but no longer does. I have
tried adding a trailing slash, using single quotes, no
quotes, etc. Nothing apparently works. Please help!
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
attached mail follows:
* Thus wrote Police Trainee (policetrainee
yahoo.com):
> When the server upgraded to php 4.3.1 from 4.2.x, I
> was no longer able to include remote html files.
> allow_url_fopen is still enabled and no other settings
> have changed. Running Apache 1.3.27 on Linux.
>
>
> This is one line that I use to call the remote html
> file. It also has not changed since the upgrade:
>
> <?include("http://143.43.222.103/sga");?>
>
> This line worked before, but no longer does. I have
> tried adding a trailing slash, using single quotes, no
> quotes, etc. Nothing apparently works. Please help!
Was --disable-url-fopen-wrapper compiled in php?
You can check your phpinfo() output in that.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
my phpinfo output does not have that particular init
value "disable-url-fopen-wrapper". "allow_url_fopen"
is enabled, safemode is off, and include_path is set
to .:/usr/local/lib/php. further ideas?
--- Curt Zirzow <curt
zirzow.dyndns.org> wrote:
> * Thus wrote Police Trainee
> (policetrainee
yahoo.com):
> > When the server upgraded to php 4.3.1 from 4.2.x,
> I
> > was no longer able to include remote html files.
> > allow_url_fopen is still enabled and no other
> settings
> > have changed. Running Apache 1.3.27 on Linux.
> >
> >
> > This is one line that I use to call the remote
> html
> > file. It also has not changed since the upgrade:
> >
> > <?include("http://143.43.222.103/sga");?>
> >
> > This line worked before, but no longer does. I
> have
> > tried adding a trailing slash, using single
> quotes, no
> > quotes, etc. Nothing apparently works. Please
> help!
>
> Was --disable-url-fopen-wrapper compiled in php?
>
> You can check your phpinfo() output in that.
>
> Curt
> --
> "I used to think I was indecisive, but now I'm not
> so sure."
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
attached mail follows:
* Thus wrote Dale Hersh (dalehersh
hotmail.com):
> I have a question regarding the count function. Here goes:
>
> Lets pretend I have this array called myStuff. If I add two elements to
> myStuff and call the count function, I will get a result of 2. My question
> is how do I re-initialize the array after adding elements so when I call the
> count function on the array, I get a result of 0.
unset($myStuff);
or
$myStuff = array();
I usually prefer the empty array method vs. using unset for coding
things like:
$arr = array();
func_to_mod_array($arr);
foreach($arr as $key => val) {
//....
}
If I used the unset function I'd have to check to see if the
variable is set or not.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Does anyone know what sorting algorithm(s) -- quicksort, mergesort,
radix sort, etc. -- does PHP use internally in its sort function?
attached mail follows:
* Thus wrote Shaunak Kashyap (skashyap
intertechmedia.com):
> Does anyone know what sorting algorithm(s) -- quicksort, mergesort,
> radix sort, etc. -- does PHP use internally in its sort function?
Zend actually does the sorting, and its quicksort.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
attached mail follows:
Okay... this probably isn't that hard to do... but I am just not sure to
do it... so i will ask you guys... i amsure someone is going to have a
one liner for me here!
I am making a survey/poll builder everything is dynamic... there is an
admin section where the user can make the new survey.. and set certain
surveys as active.... but this where I am coming into some
difficulties.... the program builds the form dynamically... all radio
buttons... when the user submits the form i need to disect each form
answer and then dump it into MySQL... So I need to know if I can do
something like use the 'explode()' function no this... and assign them
to variables... I need to draw out the radio button id and what they
answered...
hope that makes sense... thanks for all your help in advance
Joe Harman
http://www.HarmanMedia.com
Only two things are infinite, the universe and human stupidity, and I'm
not sure about the former. - Albert Einstein
attached mail follows:
The name of the set of radio buttons is the QuestionID (so it's a
number)... And the options are the AnswerID (they are also numbers)...
-----Original Message-----
From: Shaunak Kashyap [mailto:skashyap
intertechmedia.com]
Sent: Friday, July 25, 2003 1:03 AM
To: Joe Harman
Subject: Re: help with explode.....
> I am making a survey/poll builder everything is dynamic... there is an
> admin section where the user can make the new survey.. and set certain
> surveys as active.... but this where I am coming into some
> difficulties.... the program builds the form dynamically... all radio