php-general Digest 27 Jan 2009 13:05:57 -0000 Issue 5925

Topics (messages 287193 through 287209):

Variable formatting problem using sessions...
        287193 by: Rick Duval
        287198 by: Chris

Re: Coding for email response forms
        287194 by: Edmund Hertle

Re: Multiple queries in PHP
        287195 by: Edmund Hertle
        287197 by: Chris

Re: PHP 5.2.8 fails to find libiconv
        287196 by: Chris

Doc standard for methods?
        287199 by: Larry Garfield

Re: Make New-Age Money Online with Google
        287200 by: clive
        287201 by: Stuart
        287206 by: Martin Zvarík

Get Money Fast with the Government Grants
        287202 by: Dora Gaskins
        287203 by: clive
        287204 by: Andrew Williams

Re: best practice wrt multi-lingual websites, gettext() etc.
        287205 by: Per Jessen
        287207 by: Jan Ka¹tánek
        287208 by: Per Jessen
        287209 by: Phpster

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
I'm using an "OnClick" routine to set a session variable before I go
to another page.

onClick=<?php $_SESSION['local_part']= 'rick'; ?>   works fine but I
need a variable where "rick" is

I've tried

onClick=<?php $_SESSION['local_part']= $local_part; ?>

and other variations but it doesn't work.

Can anybody tell me what the proper formatting is to get this to
resolve correctly?

Thanks

Rick

--- End Message ---
--- Begin Message ---
Rick Duval wrote:
I'm using an "OnClick" routine to set a session variable before I go
to another page.

onClick=<?php $_SESSION['local_part']= 'rick'; ?>   works fine but I
need a variable where "rick" is

I've tried

onClick=<?php $_SESSION['local_part']= $local_part; ?>

and other variations but it doesn't work.

Can anybody tell me what the proper formatting is to get this to
resolve correctly?

Not sure what you're trying to do exactly, but if you're trying to get the 'onClick' to set the $_SESSION['local_part'] variable, it won't.

onClick is handled by your browser. PHP runs from the server and has no idea what your browser is doing.

You either need to do an ajax call to connect to the server, set the session var, then do the page redirect - or use a get variable and use that on the next page.

--
Postgresql & php tutorials
http://www.designmagick.com/


--- End Message ---
--- Begin Message ---
2009/1/26 Tom <obeli...@comcast.net>

>
> "Shawn McKenzie" <sh...@mckenzies.net> wrote in message
> news:497e3ab9.2060...@mckenzies.net...
> >
> >
> > Shawn McKenzie wrote:
> >>
> >> Tom Scott wrote:
> >>> ----- Original Message ----- From: "Shawn McKenzie"
> >>> <nos...@mckenzies.net>
> >>> Newsgroups: php.general
> >>> To: <php-gene...@lists.php.net>
> >>> Sent: Monday, January 26, 2009 3:52 PM
> >>> Subject: Re: [PHP] Coding for email response forms
> >>>
> >>>
> >>>> Tom wrote:
> >>>>> "Shawn McKenzie" <> wrote in message
> >>>>> news:a0.87.62571.3d92e...@pb1.pair.com...
> >>>>>> Tom wrote:
> >>>>>>> My Hosting site said that I needed to include the PHP otherwise
> >>>>>>> the form
> >>>>>>> won't work. I need to know where to include my email info to get
> >>>>>>> this set
> >>>>>>> up
> >>>>>>> don't I? What do you suggest?
> >>>>>>> T
> >>>>>>> "Daniel Brown" <danbr...@php.net> wrote in message
> >>>>>>> news:ab5568160901261259p6d6442a4ya5ea4134025e5...@mail.gmail.com.
> ..
> >>>>>>>> On Mon, Jan 26, 2009 at 15:57, Tom <obeli...@comcast.net> wrote:
> >>>>>>>>> I am a new user of PHP, and am using Dreamweaver CS3 for the
> >>>>>>>>> webpages.
> >>>>>>>>> The
> >>>>>>>>> following page has my form but the submit button is not working
> >>>>>>>>> properly.
> >>>>>>>>> http://www.richlandmtg.com/contacts.html
> >>>>>>>>> What code is needed and where does it get placed in the page.? I
> >>>>>>>>> thought
> >>>>>>>>> CS3
> >>>>>>>>> took care of this.
> >>>>>>>>    Tom,
> >>>>>>>>
> >>>>>>>>    This issue has nothing at all to do with PHP.  This is all
> >>>>>>>> client
> >>>>>>>> side (JavaScript and HTML).
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>> </Daniel P. Brown>
> >>>>>>>> daniel.br...@parasane.net || danbr...@php.net
> >>>>>>>> http://www.parasane.net/ || http://www.pilotpig.net/
> >>>>>>>> Unadvertised dedicated server deals, too low to print - email me
> >>>>>>>> to find
> >>>>>>>> out!
> >>>>>> What you have now is a form that when submitted sends the data to
> >>>>>> itself.  So you either need to include some php in this file to
> >>>>>> gather
> >>>>>> up the data and email it when submitted, or submit to another file
> >>>>>> that
> >>>>>> does that.
> >>>>>>
> >>>>>>
> >>>>>> --
> >>>>>> Thanks!
> >>>>>> -Shawn
> >>>>>> http://www.spidean.com
> >>>>> Shawn,
> >>>>> So would that look something like this:
> >>>>> <?
> >>>>> if ($_SERVER['REQUEST_METHOD'] == "POST") {
> >>>>>
> >>>>> // Just to be safe, I strip out HTML tags
> >>>>> $realname = strip_tags($realname);
> >>>>> $email = strip_tags($email);
> >>>>> $feedback = strip_tags($feedback);
> >>>>>
> >>>>> // set the variables
> >>>>> // replace $...@mysite.com with your email
> >>>>> $sendto = "$...@mysite.com";
> >>>>> $subject = "Sending Email Feedback From My Website";
> >>>>> $message = "$realname, $email\n\n$feedback";
> >>>>>
> >>>>> // send the email
> >>>>> mail($sendto, $subject, $message);
> >>>>>
> >>>>> }
> >>>>> ?>
> >>>>>
> >>>>>
> >>>>>
> >>>> Oh, you should also think about some other things, such as validation.
> >>>> Is realname only alpha characters?  Is email in the form of a real
> >>>> email
> >>>> address?  At a bare minimum, are they not empty:
> >>>>
> >>>> if (empty($_POST['email']) ||
> >>>> empty($_POST['realname']) ||
> >>>> empty($_POST['feedback']))
> >>>> {
> >>>>        echo 'You must complete all required fields!';
> >>>> // show form again
> >>>> }
> >>>>
> >>>>
> >>>> --
> >>>> Thanks!
> >>>> -Shawn
> >>>> http://www.spidean.com
> >>> Ok. I have the validation part.
> >>> http://www.richlandmtg.com/index-5.html still working on the Send
> >>> button.
> >>>
> >>> T
> >>>
> >>>
> >> Please reply all so this stays on the list.
> >>
> >> 1.  In the source for your link I see that the JS is doing some
> >> validation.
> >> 2.  You have method="get" in your form.  This will work, but you'll have
> >> to change the PHP code to use $_GET instead of $_POST vars.  Or change
> >> to method="post" in the form.
> >> 3.  If you want to keep the .html extension for the page, then you'll
> >> probably need to send the post to another script with a .php extension.
> >> Normally a file with a .html extension won't execute the PHP code.
> >>
> >> Thanks!
> >> -Shawn
> >>
> >>
> >>
> I was just looking at that. Someone told me to use GET instead of POST.
> Since JS is validating is it as easy replacing GET with POST ? Nothing else
> needed? Is it better to remove the JS and just code using PHP as you showed
> before?
> if (empty($_POST['email']) ||
> empty($_POST['realname']) ||
> empty($_POST['feedback']))
>
> Thanks,
> Tom


Yes, I think it is better to just use PHP code and post is the better method
(in this case) because with get all your fields and values will show up in
the url

-eddy

--- End Message ---
--- Begin Message ---
2009/1/26 Chris <dmag...@gmail.com>

>
>
>> This extension does not have to be installed. If your server is running
>> php5, then this extension is installed
>>
>
> No it's not. The mysql extension no longer ships with php by default, you
> have to build it when you ./configure or install the external php-mysql
> package (depending on your o/s and/or how you built it).
>
> If you have the php-mysql package installed, then you have mysqli - but
> it's not there by default.


Yes this is right. This was my fault. I think I got it mixed up with another
extension, sorry.

-eddy

--- End Message ---
--- Begin Message ---
Per Jessen wrote:
Ashley Sheridan wrote:

I've run into a bit of a problem. I put together a query using mysql
variables in the form set @m:= 0; with the select that uses it
directly after. For any wondering, the select was using it as an
incremental value which can't be hard coded, as the value will depend
on the ordering of the results of the query itself.

The problem seems to be that while phpMyAdmin would execute this
double query perfectly well, php using mysql_query() was having
problems, as apparently it can't actually run multiple queries.

I don't know about the PHP mysql_query(), but the MySQL C API works fine
with multiple queries, it just has to be specifically enabled - the
default is one query per call. However, it looks like the multiple query option is not supported by PHP:
http://php.net/manual/en/mysqli.real-connect.php

"For security reasons the MULTI_STATEMENT flag is not supported in PHP.
If you want to execute multiple queries use the mysqli_multi_query()
function."

Same for mysql_query:

"mysql_query() sends a unique query (multiple queries are not supported)"...

--
Postgresql & php tutorials
http://www.designmagick.com/


--- End Message ---
--- Begin Message ---
Ro Achterberg wrote:
Hi,

I'm attempting to install PHP 5.2.8 on CentOS 5.2 x86_64. The glibc iconv 
doesn't seem to function very well, leading to a bunch of failed tests when 
running 'make test' (see below). After a bit of Googling I stumbled upon 
http://nl2.php.net/manual/en/intro.iconv.php which suggests to install libiconv 
instead of relying on glibc's iconv, when things go wrong.

My configure line reads as follows:

./configure --prefix=/chroot/apache2/php --with-apxs2=/chroot/apache2/bin/apxs 
--disable-cgi --with-zlib --with-gettext --enable-sockets --with-xmlrpc 
--with-xsl --with-config-file-path=/php/etc --with-mcrypt --enable-mbregex 
--with-gd --with-mime-magic=/usr/share/mime/magic --enable-mbstring=all 
--with-openssl --with-mysql=/chroot/mysql --with-curl=/usr/lib64 --enable-zip 
--with-freetype-dir=/usr/lib64 --with-png-dir --with-jpeg-dir 
--with-libdir=lib64 --with-gnu-ld --with-iconv=/usr/local/lib

which yields the following result:

--------
checking for iconv support... yes
configure: error: Please reinstall the iconv library.
--------

what's in config.log ?

Configure runs fine when I omit the path in the --with-iconv directive, but 
that will use glibc's iconv, which results in the following failed tests when 
running make check:

You might have more luck asking on the installs list (http://www.php.net/mailing-lists.php).


--
Postgresql & php tutorials
http://www.designmagick.com/


--- End Message ---
--- Begin Message ---
Greetings, all.  I am looking for feedback on a documentation question, in the 
hopes that someone else has found a good solution to an abnormal situation.

We're in the process of introducing OOP syntax to a large procedural code 
base.  Our developer base is a mixture of people who are procedural-centric 
and those that flip between procedural and OOP easily.  One area we've run into 
is documenting some of the more complex OOP interactions.  For example, if we 
have a method chain:

foo()->bar()->baz()->narf();

some developers have expressed concern in figuring out which narf() method is 
actually being called, since foo(), bar() and baz() may return objects of 
different classes (of the same interface) depending on various conditions (the 
classic factory pattern).  

Currently, we're including a docblock (Doxygen, close enough to PHPDoc for 
government work) on the interface or parent class that has full docs, and then 
nothing on the child classes.  My understanding of docblocks is that most 
documentation parsers prefer that, so that the docblock itself inherits.  

One suggestion that has been raised is to reference the parent class and 
factory function in a comment after the method signature.  That is:

class Narfing_mysql {
  // ...

 public function narf() { // Narfing  foo()
    // ...
 }
}

So that it can be easily grepped for.  That strikes me as a very hacky non-
solution.  Does anyone else have a recommendation for how to improve such 
documentation?  Is there a standard in PHPDoc that I don't know about?  Any 
other projects doing something like that?

-- 
Larry Garfield
la...@garfieldtech.com

--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
On Sat, 2009-01-24 at 10:14 +0200, Dora Elless wrote:
That's why I am sending this email only to people I know and care
about.
And they send to a mailing list. Come again?


So Funny, they went through all the trouble of signing up, unless hey have bots now that can sign up to mailing lists?


--- End Message ---
--- Begin Message ---
2009/1/27 clive <clive_li...@immigrationunit.com>:
> Ashley Sheridan wrote:
>>
>> On Sat, 2009-01-24 at 10:14 +0200, Dora Elless wrote:
>>
>>>
>>> That's why I am sending this email only to people I know and care
>>> about.
>>>
>>
>> And they send to a mailing list. Come again?
>>
>>
>
> So Funny, they went through all the trouble of signing up, unless hey have
> bots now that can sign up to mailing lists?

Yes they do - it's not hard, but you don't actually need to subscribe
to PHP mailing lists to post to them.

-Stuart

-- 
http://stut.net/

--- End Message ---
--- Begin Message ---
Ashley Sheridan napsal(a):
On Sat, 2009-01-24 at 10:14 +0200, Dora Elless wrote:
That's why I am sending this email only to people I know and care
about.
And they send to a mailing list. Come again?


Ash
www.ashleysheridan.co.uk


The sad thing though is that there will be always people who believe this shit and pays...

Like my dad bought a little book "Take off your glasses" for $10 and he received 2 papers saying: sun is our best friend, look right into it and it will heal your eyes.
--- End Message ---
--- Begin Message ---
If you have received this email, take a time to really read it carefully!

You may be one of the luckiest people ever to get a Government Funded Grant. 
This Grant Kit could put thousands of dollars in your pocket. If you are in 
need of a financial assistance, you may qualify for a piece of the millions and 
millions of dollars awarded each year by private and government grant agencies 
to regular people like you.

What makes grants so exciting is that most of the money is awarded 
INTEREST-FREE. So, unlike a bank loan, you won't see interest charges eating 
away at your obligations. That's a better offer than any bank will ever provide 
you.

Many grants go unawarded every year, simply because most people don't know 
about the programs they may qualify for. Don't let this happen to you!

Join this great program right away with no risk at all! Send us an email back 
to hosanna.gayhart15...@gmail.com if you are interested to participate in the 
easy Government Funded Grant program. Don't miss your chance, as chances like 
that don't happen very often in our lives!

American Gov Money

--- End Message ---
--- Begin Message ---
Dora Gaskins wrote:
If you have received this email, take a time to really read it carefully!

American Gov Money
More spam, can't we have the maillist software require people to register before posting?


--- End Message ---
--- Begin Message ---
Hi,
Beware of he spam mailer so do not let them spam your money away.

Andrew

On Tue, Jan 27, 2009 at 9:18 AM, clive <clive_li...@immigrationunit.com>wrote:

> Dora Gaskins wrote:
>
>> If you have received this email, take a time to really read it carefully!
>>
>> American Gov Money
>>
> More spam, can't we have the maillist software require people to register
> before posting?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 

Best Wishes
Andrew Williams
-------------------
31 Davies Street
W1K 4LP, London, UK
www.NetPosten.dk

--- End Message ---
--- Begin Message ---
Bastien Koert wrote:

> No, as all of our users have to authorized to use the app, we store
> the desired language in a field in the user record. However, we also
> supply functionality via a drop down to allow the user to change the
> language if desired.

Okay, that's very similar to my approach.  For first-time users (of
which I will have a lot), the language is set by their browser's
language setting.  Most users won't be changing it.

> I agree its difficult to separate the language and the code, but if
> you create xslt / html files for each language then its a much simpler
> matter, and far less resouce intensive, to direct the user to that
> page in their desired language. 

I leave that to Apache and the 'prefer-language' environment variable -
I guess my main issue is to do with e.g. error-messages from PHP code
("please complete this field correctly" etc) and from javascript ditto. 

I guess for error-messages, it's back to gettext(), which does make some
sense. 

> Again, you and just use PHP and handle the labels and option (drop
> downs, radios etc) variables in real time  but I never see the point
> in doing the same thing over and over again when its much cleaner (if
> more management intensive)  to direct the user to a static resource
> and pass in an XML string with the data in it.

Totally agree. 

> At work, we don't use gettext() since :
> a) its an classic ASP shop (  :-(  ), therefore no Linux and no PHP

Ah. :-)

> b) the db current doesn't support multi-byte charsets
> 

The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Per Jessen:
>
>  The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.

It supports. We use it. But only in MsgStr (translation), not in MsgId
(original strings).

-- 
toby

http://toby.cz/

--- End Message ---
--- Begin Message ---
Jan Kaštánek wrote:

> Per Jessen:
>>
>>  The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.
> 
> It supports. We use it. But only in MsgStr (translation), not in MsgId
> (original strings).
> 

Yeah, I found out too.  (from the GNU gettext docu).


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Sorry guys,

I meant that the current application database is not configured for utf-8

Bastien

Sent from my iPod

On Jan 27, 2009, at 6:04, Per Jessen <p...@computer.org> wrote:

Jan Kaštánek wrote:

Per Jessen:

The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.

It supports. We use it. But only in MsgStr (translation), not in MsgId
(original strings).


Yeah, I found out too.  (from the GNU gettext docu).


/Per Jessen, Zürich


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


--- End Message ---

Reply via email to