Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-21 Thread shiplu
On Apr 22, 2013 7:00 AM, "Bastien Koert"  wrote:
>
> I have an app that gets passed in xml and use this code to read that data
in
>
> // We use php://input to get the raw $_POST results.
> $xml_post = file_get_contents('php://input');

$xml_post is string.  I think now you know what to do.


Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-21 Thread Bastien Koert
I have an app that gets passed in xml and use this code to read that data in

// We use php://input to get the raw $_POST results.
$xml_post = file_get_contents('php://input');

Maybe it will help

Bastien


On Sat, Apr 20, 2013 at 7:48 AM, shiplu  wrote:

> >
> >
> >
> > Question: how do you use $mylist when the xml is not as a file but is
> > returned on a web page?
> >
>
> I assume  It returns as a string from page. Then use
> simplexml_load_string(). See
> http://php.net/manual/en/function.simplexml-load-string.php
>
>
> --
> Shiplu.Mokadd.im
> ImgSign.com | A dynamic signature machine
> Innovation distinguishes between follower and leader
>



-- 

Bastien

Cat, the other other white meat


Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-20 Thread shiplu
>
>
>
> Question: how do you use $mylist when the xml is not as a file but is
> returned on a web page?
>

I assume  It returns as a string from page. Then use
simplexml_load_string(). See
http://php.net/manual/en/function.simplexml-load-string.php


-- 
Shiplu.Mokadd.im
ImgSign.com | A dynamic signature machine
Innovation distinguishes between follower and leader


Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-20 Thread Matijn Woudt
On Sat, Apr 20, 2013 at 12:51 AM, dealTek  wrote:

>
> On Apr 19, 2013, at 3:32 PM, tamouse mailing lists <
> tamouse.li...@gmail.com> wrote:
>
> >>
> >> page1.php is sending out to credit card company - getting processed -
> then coming back to the *same page1.php* with the XML data listed below...
> >
> > Please expand what you mean by "sending out" and "coming back" - is
> > this a REST or SOAP API call? In that case, the response body is
> > likely to be the XML.
> >
> >>
> >> - so I'm not going to some other page to get it - it is coming to me to
> the same page I am on..
> >>
> >> so - after the XML result comes in - I need to assign the php to the
> XML somehow...
> >
> > How do you recognize the "XML result com(ing) in" ?
> >
>
> Hi tamouse,
>
> with my untrained eye - it appears that this  is what is 'sending out'
>
>
>  $data = sendXMLviaCurl($xmlRequest,$gatewayURL);
>
>
> and this might be what is 'responding back' on the same page
>
>
> $gwResponse = @new SimpleXMLElement((string)$data);
>
>
> you can see these lines towards the bottom at - // Process Step Three...
>
>
Why did you prefix this with @? This way your hiding the real error that is
probably the answer to why it is not working.

- Matijn


Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-20 Thread tamouse mailing lists
This will be brief as I'm on a tablet...

On Apr 19, 2013 5:53 PM, "dealTek"  wrote:
>
>
> On Apr 19, 2013, at 3:32 PM, tamouse mailing lists <
tamouse.li...@gmail.com> wrote:
>
> >>
> >> page1.php is sending out to credit card company - getting processed -
then coming back to the *same page1.php* with the XML data listed below...
> >
> > Please expand what you mean by "sending out" and "coming back" - is
> > this a REST or SOAP API call? In that case, the response body is
> > likely to be the XML.
> >
> >>
> >> - so I'm not going to some other page to get it - it is coming to me
to the same page I am on..
> >>
> >> so - after the XML result comes in - I need to assign the php to the
XML somehow...
> >
> > How do you recognize the "XML result com(ing) in" ?
> >
>
> Hi tamouse,
>
> with my untrained eye - it appears that this  is what is 'sending out'
>
>
>  $data = sendXMLviaCurl($xmlRequest,$gatewayURL);

This is the  sending and receiving -- the function uses curl to send your
xml request and returns the response from that.

>
>
> and this might be what is 'responding back' on the same page
>
>
> $gwResponse = @new SimpleXMLElement((string)$data);

$data contains the response, this is how you are processing it.

Skipping the long and monolithic code, what I will suggest is that you
break things up into modules, functions and procrdures, and write unit
tests that will check each piece seperately. After you've verified that
each step is working, then you can start to integrate the pieces, following
the stricture of keeping code (logic), data, and presentation seperate.

It is much easier to deal with debugging when your code is simple and does
only one thing. Break out the part you are asking here about, the API call.
Build up a viable test request that will get you a known response and make
sure you are getting what you expect. My suspicion is that the response
here isnot what you expect.

>


Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread dealTek

On Apr 19, 2013, at 3:32 PM, tamouse mailing lists  
wrote:

>> 
>> page1.php is sending out to credit card company - getting processed - then 
>> coming back to the *same page1.php* with the XML data listed below...
> 
> Please expand what you mean by "sending out" and "coming back" - is
> this a REST or SOAP API call? In that case, the response body is
> likely to be the XML.
> 
>> 
>> - so I'm not going to some other page to get it - it is coming to me to the 
>> same page I am on..
>> 
>> so - after the XML result comes in - I need to assign the php to the XML 
>> somehow...
> 
> How do you recognize the "XML result com(ing) in" ?
> 

Hi tamouse,

with my untrained eye - it appears that this  is what is 'sending out'


 $data = sendXMLviaCurl($xmlRequest,$gatewayURL);


and this might be what is 'responding back' on the same page


$gwResponse = @new SimpleXMLElement((string)$data);


you can see these lines towards the bottom at - // Process Step Three...


---



the page code is long - so i cut out some extra lines - but this is
===


all page code - with edits...

https://secure.webxxx.com/api/test';

$APIKey = 'xxx';





// If there is no POST data or a token-id, print the initial shopping cart form 
to get ready for Step One.

if (empty($_POST['DO_STEP_1'])&& empty($_GET['token-id'])) {



print '  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>';

print '



  



Collect non-sensitive Customer Info 

  

  

  Step One: Collect non-sensitive payment information.



   Customer Information

   Billing Details





  

  Company

 
 
 --- more



   Shipping Details

  
  
  --more
  

   

  Total Amount $12.00 

  

  





  





';

}else if (!empty($_POST['DO_STEP_1'])) {



// Initiate Step One: Now that we've collected the non-sensitive payment 
information, we can combine other order information and build the XML format.

$xmlRequest = new DOMDocument('1.0','UTF-8');



$xmlRequest->formatOutput = true;

$xmlSale = $xmlRequest->createElement('sale');



// Amount, authentication, and Redirect-URL are typically the bare mininum.

appendXmlNode($xmlSale,'api-key',$APIKey);

appendXmlNode($xmlSale,'redirect-url',$_SERVER['HTTP_REFERER']);

appendXmlNode($xmlSale, 'amount', '12.00');

appendXmlNode($xmlSale, 'ip-address', $_SERVER["REMOTE_ADDR"]);

//appendXmlNode($xmlSale, 'processor-id' , 'processora');

appendXmlNode($xmlSale, 'currency', 'USD');

//appendXmlNode($xmlSale, 'dup-seconds' , '2');



// Some additonal fields may have been previously decided by user

appendXmlNode($xmlSale, 'order-id', '1234');

appendXmlNode($xmlSale, 'order-description', 'Small Order');

appendXmlNode($xmlSale, 'merchant-defined-field-1' , 'Red');

appendXmlNode($xmlSale, 'merchant-defined-field-2', 'Medium');

appendXmlNode($xmlSale, 'tax-amount' , '2.00');

appendXmlNode($xmlSale, 'shipping-amount' , '0.00');



/*if(!empty($_POST['customer-vault-id'])) {

appendXmlNode($xmlSale, 'customer-vault-id' , 
$_POST['customer-vault-id']);

}else {

 $xmlAdd = $xmlRequest->createElement('add-customer');

 appendXmlNode($xmlAdd, 'customer-vault-id' ,411);

 $xmlSale->appendChild($xmlAdd);

}*/





// Set the Billing & Shipping from what was collected on initial shopping 
cart form

$xmlBillingAddress = $xmlRequest->createElement('billing');

appendXmlNode($xmlBillingAddress,'first-name', 
$_POST['billing-address-first-name']);

//-more


//billing-address-email

appendXmlNode($xmlBillingAddress,'country', 
$_POST['billing-address-country']);

appendXmlNode($xmlBillingAddress,'email', $_POST['billing-address-email']);

//more

$xmlSale->appendChild($xmlBillingAddress);





$xmlShippingAddress = $xmlRequest->createElement('shipping');

appendXmlNode($xmlShippingAddress,'first-name', 
$_POST['shipping-address-first-name']);

appendXmlNode($xmlShippingAddress,'last-name', 
$_POST['shipping-address-last-name']);

// more

appendXmlNode($xmlShippingAddress,'fax', $_POST['shipping-address-fax']);

$xmlSale->appendChild($xmlShippingAddress);





// Products already chosen by user

$xmlProduct = $xmlRequest->createElement('product');

appendXmlNode($xmlProduct,'product-code' , 'SKU-123456');

   
   
   
   // more

appendXmlNode($xmlProduct,'alternate-tax-id' , '12345');



$xmlSale->appendChild($xmlProduct);



$xmlProduct = $xmlRequest->createElement('product');

appendXmlNode($xmlProduct,'product-code' , 'SKU-123456');

appendXmlNode($xmlProduct,'description' , 'test 2 product description');



  

Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread tamouse mailing lists
On Fri, Apr 19, 2013 at 4:04 PM, dealTek  wrote:
>
> On Apr 19, 2013, at 1:33 PM, Sebastian Krebs  wrote:
>
>> A "webpage" is a file, that (usually) a browser downloads and parses. You'll 
>> do exactly the same :-) I don't know exactly, but you can try to pass the 
>> URL directly to simplexml_load_file(). If this doesn't work, download the 
>> content (for example with file_get_contents()) and pass it to 
>> simplexml_load_string(). There are obviously many other approaches, but you 
>> should now have an idea :-)
>>
>
> Thanks Sebastian for the help
>
> Actually what is happening in my case is:
>
> page1.php is sending out to credit card company - getting processed - then 
> coming back to the *same page1.php* with the XML data listed below...

Please expand what you mean by "sending out" and "coming back" - is
this a REST or SOAP API call? In that case, the response body is
likely to be the XML.

>
> - so I'm not going to some other page to get it - it is coming to me to the 
> same page I am on..
>
> so - after the XML result comes in - I need to assign the php to the XML 
> somehow...

How do you recognize the "XML result com(ing) in" ?



>
> I hope I am making myself clear
>
> Thanks in advance for the help
>
>
>> Or you use a specialized library like Guzzle.
>>
>> Am 19.04.2013 22:17 schrieb "dealTek" :
>> Hi all,
>>
>> newbie - just starting with trying to parse XML...
>>
>>
>> $mylist = simplexml_load_file('thelist.xml');
>>
>> then use a foreach to echo the data...
>>
>> > $mysongs = simplexml_load_file('songs.xml');
>>
>> foreach ($mysongs as $songinfo) {
>> $title=$songinfo->title;
>> $artist=$songinfo->artist;
>> $date=$songinfo['dateplayed'];
>> echo $title.' --- ';
>> echo $artist.' --- ';
>> echo $date.' --- ';
>> echo '  ';
>> }
>>
>> ?>
>>
>> that I get ...
>>
>> Question: how do you use $mylist when the xml is not as a file but is 
>> returned on a web page?
>>
>>
>> an example of the real xml I am trying to work with is like this demo below 
>> 
>>
>> Goal : when this response comes back - I would like to be able to get the 
>> data as php and then update the database
>>
>>
>> example
>> 
>> 
>>   1
>>   SUCCESS
>>   1865264174
>>   100
>>   123456
>>   N
>>   N
>>   sale
>>   12.00
>>   ::1
>>   ecommerce
>>   ccprocessora
>>   USD
>>   Small Order
>>   Red
>>   Medium
>>   1234
>>   2.00
>>   0.00
>>   
>> John
>> Smith
>> 1234 Main St.
>> Beverly Hills
>> CA
>> 90210
>> US
>> 555-555-
>> t...@example.com
>> Acme, Inc.
>> 40**0002
>> 0118
>>   
>>   
>> Mary
>> Smith
>> 1234 Main St.
>> Beverly Hills
>> CA
>> 90210
>> US
>> Unit #2
>>   
>>   
>> SKU-123456
>> test product description
>> abc
>> 1
>> 5.
>> 1.
>> 7.00
>> 2.00
>> 1.00
>> 2.00
>> 1.00
>> sales
>> 12345
>>   
>>   
>> SKU-123456
>> test 2 product description
>> abc
>> 2
>> 2.5000
>> 2.
>> 7.00
>> 2.00
>> 1.00
>> 2.00
>> 1.00
>> sales
>> 12345
>>   
>> 
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>> Thanks,
>> Dave - DealTek
>> deal...@gmail.com
>> [db-3]
>>
>
>
> --
> Thanks,
> Dave - DealTek
> deal...@gmail.com
> [db-3]
>

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



Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread dealTek

On Apr 19, 2013, at 1:33 PM, Sebastian Krebs  wrote:

> A "webpage" is a file, that (usually) a browser downloads and parses. You'll 
> do exactly the same :-) I don't know exactly, but you can try to pass the URL 
> directly to simplexml_load_file(). If this doesn't work, download the content 
> (for example with file_get_contents()) and pass it to 
> simplexml_load_string(). There are obviously many other approaches, but you 
> should now have an idea :-)
> 

Thanks Sebastian for the help

Actually what is happening in my case is:

page1.php is sending out to credit card company - getting processed - then 
coming back to the *same page1.php* with the XML data listed below...

- so I'm not going to some other page to get it - it is coming to me to the 
same page I am on..

so - after the XML result comes in - I need to assign the php to the XML 
somehow...

I hope I am making myself clear

Thanks in advance for the help


> Or you use a specialized library like Guzzle.
> 
> Am 19.04.2013 22:17 schrieb "dealTek" :
> Hi all,
> 
> newbie - just starting with trying to parse XML...
> 
> 
> $mylist = simplexml_load_file('thelist.xml');
> 
> then use a foreach to echo the data...
> 
>  $mysongs = simplexml_load_file('songs.xml');
> 
> foreach ($mysongs as $songinfo) {
> $title=$songinfo->title;
> $artist=$songinfo->artist;
> $date=$songinfo['dateplayed'];
> echo $title.' --- ';
> echo $artist.' --- ';
> echo $date.' --- ';
> echo '  ';
> }
> 
> ?>
> 
> that I get ...
> 
> Question: how do you use $mylist when the xml is not as a file but is 
> returned on a web page?
> 
> 
> an example of the real xml I am trying to work with is like this demo below 
> 
> 
> Goal : when this response comes back - I would like to be able to get the 
> data as php and then update the database
> 
> 
> example
> 
> 
>   1
>   SUCCESS
>   1865264174
>   100
>   123456
>   N
>   N
>   sale
>   12.00
>   ::1
>   ecommerce
>   ccprocessora
>   USD
>   Small Order
>   Red
>   Medium
>   1234
>   2.00
>   0.00
>   
> John
> Smith
> 1234 Main St.
> Beverly Hills
> CA
> 90210
> US
> 555-555-
> t...@example.com
> Acme, Inc.
> 40**0002
> 0118
>   
>   
> Mary
> Smith
> 1234 Main St.
> Beverly Hills
> CA
> 90210
> US
> Unit #2
>   
>   
> SKU-123456
> test product description
> abc
> 1
> 5.
> 1.
> 7.00
> 2.00
> 1.00
> 2.00
> 1.00
> sales
> 12345
>   
>   
> SKU-123456
> test 2 product description
> abc
> 2
> 2.5000
> 2.
> 7.00
> 2.00
> 1.00
> 2.00
> 1.00
> sales
> 12345
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Thanks,
> Dave - DealTek
> deal...@gmail.com
> [db-3]
> 


--
Thanks,
Dave - DealTek
deal...@gmail.com
[db-3]



Re: [PHP] Newbie Question - Parse XML with PHP...

2013-04-19 Thread Sebastian Krebs
A "webpage" is a file, that (usually) a browser downloads and parses.
You'll do exactly the same :-) I don't know exactly, but you can try to
pass the URL directly to simplexml_load_file(). If this doesn't work,
download the content (for example with file_get_contents()) and pass it to
simplexml_load_string(). There are obviously many other approaches, but you
should now have an idea :-)

Or you use a specialized library like Guzzle.
Am 19.04.2013 22:17 schrieb "dealTek" :

> Hi all,
>
> newbie - just starting with trying to parse XML...
>
>
> $mylist = simplexml_load_file('thelist.xml');
>
> then use a foreach to echo the data...
>
>  $mysongs = simplexml_load_file('songs.xml');
>
> foreach ($mysongs as $songinfo) {
> $title=$songinfo->title;
> $artist=$songinfo->artist;
> $date=$songinfo['dateplayed'];
> echo $title.' --- ';
> echo $artist.' --- ';
> echo $date.' --- ';
> echo '  ';
> }
>
> ?>
>
> that I get ...
>
> Question: how do you use $mylist when the xml is not as a file but is
> returned on a web page?
>
>
> an example of the real xml I am trying to work with is like this demo
> below 
>
> Goal : when this response comes back - I would like to be able to get the
> data as php and then update the database
>
>
> example
> 
> 
>   1
>   SUCCESS
>   1865264174
>   100
>   123456
>   N
>   N
>   sale
>   12.00
>   ::1
>   ecommerce
>   ccprocessora
>   USD
>   Small Order
>   Red
>   Medium
>   1234
>   2.00
>   0.00
>   
> John
> Smith
> 1234 Main St.
> Beverly Hills
> CA
> 90210
> US
> 555-555-
> t...@example.com
> Acme, Inc.
> 40**0002
> 0118
>   
>   
> Mary
> Smith
> 1234 Main St.
> Beverly Hills
> CA
> 90210
> US
> Unit #2
>   
>   
> SKU-123456
> test product description
> abc
> 1
> 5.
> 1.
> 7.00
> 2.00
> 1.00
> 2.00
> 1.00
> sales
> 12345
>   
>   
> SKU-123456
> test 2 product description
> abc
> 2
> 2.5000
> 2.
> 7.00
> 2.00
> 1.00
> 2.00
> 1.00
> sales
> 12345
>   
> 
>
>
>
>
>
>
>
>
> --
> Thanks,
> Dave - DealTek
> deal...@gmail.com
> [db-3]
>
>


Re: [PHP] Newbie question. What is the best structure of a php-app?

2011-08-16 Thread Richard Quadling
On 16 August 2011 09:53, Dajka Tamás  wrote:
> Hi,
>
> Surely there's a wiki/doc somewhere :)
>
> But for the start:
>
> 1) plan what exactly you want to accomplish ( functionality )
> 2) complexity
>        - if simple, just throw it in one php ( like index.php )
>        - if more complex, you can separate the pages and/or use classes
> 3) based on 2), plan the structure ( I'm using mostly one entry point - 
> index.php - with classes, templates, files included, since I like things 
> separated )
>
> Some thing you should not forget:
> - whole webapp thing is event based ( client will do something - press a link 
> - and the server will react ) - the connection is not maintained all the time
> - PHP is server side (harder to debug), you cannot do anything on client side 
> ( just push what to display ) ( JS is client side )
> - you can start the session whenever you want ( it's nearly the first line of 
> my app ), but you should control the access with variables, like if ( 
> $_SESSION['uid'] ) or if ( $_SESSION['loggedin'] )
> - most webservers interprets things between  even if the file name 
> ends with .htm or .html
> - for JS and connection related things FireBug for FireFox is a good idea ( 
> you can track, what's submitted, etc )
>
> What I'm liking:
>
> - one entry point ( index.php )
> - sub-pages, are separate php/template pairs BUT are included from index.php 
> ( after access verification, etc )
> - nearly all the functions are put in separate classes ( like user.class.php 
> for user related things - login,logout, etc )
> - using a template engine is not a very bad idea ( like Smarty ), you can 
> separate the real code from html, which make debugging easier - at least for 
> me :)
>
> BTW, take a look on some free stuff. You can always learn from others. There 
> are some good ideas in open CMS systems, like Joomla.
>
>
> Cheers,
>
>        Tom
>
> -Original Message-
> From: Andreas [mailto:maps...@gmx.net]
> Sent: Tuesday, August 16, 2011 12:39 AM
> To: php-general@lists.php.net
> Subject: [PHP] Newbie question. What is the best structure of a php-app?
>
> Hi,
> I'm fairly new to PHP but not to programming as such. Currently I sat up
> XAMPP with xdebug, Netbeans and Eclipse to get a feeling.
> I can write and run php-files but I am wondering how I should construct
> a more complex application that runs over several pages between a login
> and a logout.
>
> How would I structure such an application so that it is possible to run
> it in the debugger from the beginning?
> E.g. as a simple example I may build an index.html that has a menue with
> links to 3 php-files.
> 1)   login.php
> 2)   enter_data.php
> 3)   list_data.php
> as html-links within an ul-list.
>
> The user should at first click on login where user/password gets entered
> an a session starts.
> Then the application comes back to index.html.
> Now he might click 2) ...
>
> Is it possible to run the whole application from the start on?
> index.html is no php so xdebug won't process it and therefore the IDEs
> may start index.html but can't show the stage where the page is just
> waiting e.g. for a click on "login" and later branch for the other options.
>
> Even if I write an index.php that shows the menue eventually the script
> just dumps the html that'll wait for the following clicks.
> Those following steps are far more likely in need to be debugged.
>
> Is it neccessary to debug those subpages separately even though they
> need prior steps like login.php that store some infos in a session or
> cookie that later scripts need to rely on?
> Can I somehow watch what is going on from the index.html on?
>
> Until now I just found documentation that explains the php language.
> Thats good too but I'd need to get an idea about the "web-app-thinking"
> that consist of just pages where the designer has to hope that the user
> stays within the applicationflow instead of clicking unexpectedly on the
> back-button or just jumping off to some other site if he likes to.
>
> In contrast to this desktop-apps seem to be less demanding because I
> know where a user can navigate from a certain stage within the app and I
> could step from program start to stop with the debugger if I feel the
> need to.
>
> Is there a tutorial that explains how to build consistent web-apps
> beyond the details of php language?
>
>
> regards...

I like the Zend Framework layout where the class names and file names
are created according to a standard
(http://groups.google.com/group/php-standards/web/psr-0-final-proposal?pli=1)

And by putting the codebase outside of docroot (include_path is your
friend here), you allow the framework to be used on multiple sites on
the same server.

For me, the only things I have in my docroot are statics (css, js,
images, html) and index.php (though occasional one-shot utils will
exist there).



When I develop, I have 3 versions of the site (live, test and dev).
www.site.com, test.site.com and dev.site.com

I have sepa

RE: [PHP] Newbie question. What is the best structure of a php-app?

2011-08-16 Thread Dajka Tamás
Hi,

Surely there's a wiki/doc somewhere :)

But for the start:

1) plan what exactly you want to accomplish ( functionality )
2) complexity
- if simple, just throw it in one php ( like index.php )
- if more complex, you can separate the pages and/or use classes
3) based on 2), plan the structure ( I'm using mostly one entry point - 
index.php - with classes, templates, files included, since I like things 
separated )

Some thing you should not forget:
- whole webapp thing is event based ( client will do something - press a link - 
and the server will react ) - the connection is not maintained all the time
- PHP is server side (harder to debug), you cannot do anything on client side ( 
just push what to display ) ( JS is client side )
- you can start the session whenever you want ( it's nearly the first line of 
my app ), but you should control the access with variables, like if ( 
$_SESSION['uid'] ) or if ( $_SESSION['loggedin'] )
- most webservers interprets things between  even if the file name ends 
with .htm or .html
- for JS and connection related things FireBug for FireFox is a good idea ( you 
can track, what's submitted, etc )

What I'm liking:

- one entry point ( index.php )
- sub-pages, are separate php/template pairs BUT are included from index.php ( 
after access verification, etc )
- nearly all the functions are put in separate classes ( like user.class.php 
for user related things - login,logout, etc )
- using a template engine is not a very bad idea ( like Smarty ), you can 
separate the real code from html, which make debugging easier - at least for me 
:)

BTW, take a look on some free stuff. You can always learn from others. There 
are some good ideas in open CMS systems, like Joomla.


Cheers,

Tom

-Original Message-
From: Andreas [mailto:maps...@gmx.net] 
Sent: Tuesday, August 16, 2011 12:39 AM
To: php-general@lists.php.net
Subject: [PHP] Newbie question. What is the best structure of a php-app?

Hi,
I'm fairly new to PHP but not to programming as such. Currently I sat up 
XAMPP with xdebug, Netbeans and Eclipse to get a feeling.
I can write and run php-files but I am wondering how I should construct 
a more complex application that runs over several pages between a login 
and a logout.

How would I structure such an application so that it is possible to run 
it in the debugger from the beginning?
E.g. as a simple example I may build an index.html that has a menue with 
links to 3 php-files.
1)   login.php
2)   enter_data.php
3)   list_data.php
as html-links within an ul-list.

The user should at first click on login where user/password gets entered 
an a session starts.
Then the application comes back to index.html.
Now he might click 2) ...

Is it possible to run the whole application from the start on?
index.html is no php so xdebug won't process it and therefore the IDEs 
may start index.html but can't show the stage where the page is just 
waiting e.g. for a click on "login" and later branch for the other options.

Even if I write an index.php that shows the menue eventually the script 
just dumps the html that'll wait for the following clicks.
Those following steps are far more likely in need to be debugged.

Is it neccessary to debug those subpages separately even though they 
need prior steps like login.php that store some infos in a session or 
cookie that later scripts need to rely on?
Can I somehow watch what is going on from the index.html on?

Until now I just found documentation that explains the php language. 
Thats good too but I'd need to get an idea about the "web-app-thinking" 
that consist of just pages where the designer has to hope that the user 
stays within the applicationflow instead of clicking unexpectedly on the 
back-button or just jumping off to some other site if he likes to.

In contrast to this desktop-apps seem to be less demanding because I 
know where a user can navigate from a certain stage within the app and I 
could step from program start to stop with the debugger if I feel the 
need to.

Is there a tutorial that explains how to build consistent web-apps 
beyond the details of php language?


regards...

-- 
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



Re: [PHP] Newbie Question

2011-01-07 Thread David Hutto
On Fri, Jan 7, 2011 at 2:33 PM, tedd  wrote:
> At 2:16 AM -0500 1/7/11, Daniel Brown wrote:
>>
>> On Thu, Jan 6, 2011 at 23:09, Bill Guion  wrote:
>>>
>>>  Fogging must be a REAL OLD Fashioned term. Please clarify.
>>
>>    It was originally written before man invented the letter 'L', Bill.
>
> No, it was the predecessor to water-boarding.

Only in cultural america. In other countries, it's still used as a
public display of punishment and humiliation. And humiliation is
beneficial to no one. And spankings never did me any good anyways:)


>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com/
>
> --
> 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



Re: [PHP] Newbie Question

2011-01-07 Thread tedd

At 2:16 AM -0500 1/7/11, Daniel Brown wrote:

On Thu, Jan 6, 2011 at 23:09, Bill Guion  wrote:


 Fogging must be a REAL OLD Fashioned term. Please clarify.


It was originally written before man invented the letter 'L', Bill.


No, it was the predecessor to water-boarding.

Cheers,

tedd

--
---
http://sperling.com/

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



RE: [PHP] Newbie Question

2011-01-07 Thread Jay Blanchard
{snip]
...stuff about tedd...
[/snip]

Thank goodness there is someone on the list much older than me.

[snip]
>PS: It's not Friday yet.
[/snip]

It is now.

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



Re: [PHP] Newbie Question

2011-01-06 Thread Daniel Brown
On Thu, Jan 6, 2011 at 23:09, Bill Guion  wrote:
>
> Fogging must be a REAL OLD Fashioned term. Please clarify.

It was originally written before man invented the letter 'L', Bill.

Welcome back, by the way.  For someone who only posts once in a
[great[ while, you certainly scrutinize spelling.

-- 

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



Re: [PHP] Newbie Question

2011-01-06 Thread Bill Guion

At 11:37 AM -0500 01/06/11, tedd wrote:


At 8:16 PM -0500 1/5/11, Daniel Brown wrote:
On Wed, Jan 5, 2011 at 19:45, David Harkness 
 wrote:

[snip!]


 Most companies will gladly give their product away to put it in 
the hands of soon-to-be-professionals. :)


Tedd had his chance to be professional back in the forties (the
eighteen-forties, I believe).  Now he teaches others who still have a
chance.  ;-P

Which reminds me of an old thread from back in 2008, where I
posted Tedd's senior class picture.  You can see it here:

http://links.parasane.net/tb46


Again, you got it wrong, o' wise one -- that's a picture of my son's 
senior class.


I'm the one on the left fogging a smart-ass who refused to get out of my


Fogging must be a REAL OLD Fashioned term. Please clarify.

 -= Bill =-


chariot's way.

Boy, those were the good old days when I could flog a smart-ass.

Cheers,

tedd

PS: It's not Friday yet.

--
---
http://sperling.com/



--

Don't find fault. Find a remedy. - Henry Ford
  



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



Re: [PHP] Newbie Question

2011-01-06 Thread tedd

At 8:16 PM -0500 1/5/11, Daniel Brown wrote:
On Wed, Jan 5, 2011 at 19:45, David Harkness 
 wrote:

[snip!]


 Most companies will gladly give their product away to put it in 
the hands of soon-to-be-professionals. :)


Tedd had his chance to be professional back in the forties (the
eighteen-forties, I believe).  Now he teaches others who still have a
chance.  ;-P

Which reminds me of an old thread from back in 2008, where I
posted Tedd's senior class picture.  You can see it here:

http://links.parasane.net/tb46


Again, you got it wrong, o' wise one -- that's a picture of my son's 
senior class.


I'm the one on the left fogging a smart-ass who refused to get out of 
my chariot's way.


Boy, those were the good old days when I could flog a smart-ass.

Cheers,

tedd

PS: It's not Friday yet.

--
---
http://sperling.com/

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



Re: [PHP] Newbie Question

2011-01-05 Thread Daniel Brown
On Wed, Jan 5, 2011 at 19:45, David Harkness  wrote:
[snip!]
>
> Most companies will gladly give their product away to put it in the hands of 
> soon-to-be-professionals. :)

Tedd had his chance to be professional back in the forties (the
eighteen-forties, I believe).  Now he teaches others who still have a
chance.  ;-P

Which reminds me of an old thread from back in 2008, where I
posted Tedd's senior class picture.  You can see it here:

http://links.parasane.net/tb46

-- 

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



Re: [PHP] Newbie Question

2011-01-05 Thread David Harkness
On Wed, Jan 5, 2011 at 3:05 PM, tedd  wrote:

> I spent a couple of hours reviewing PHPStorm and it looks *very* promising!


Thank you for sharing your thoughts on PHPStorm. My main performance gripe
with NetBeans has lessened in the year I've been using it, so I'm less
inclined to go up yet another learning curve, but it's always helpful to get
input on the competitors. Please let us know if you end up using it in your
class as I'm sure others will enjoy reading your findings.

I spent about 10 minutes looking over the feature set of Komodo which was
recommended by Steve Staples in this thread, and it also looks quite
impressive. it's more expensive for the IDE (the stand-alone editor is free)
which does remote file-syncing ($295), but you might be able to swing an
educational discount with them. Most companies will gladly give their
product away to put it in the hands of soon-to-be-professionals. :)

Good luck!

David


Re: [PHP] Newbie Question

2011-01-05 Thread tedd

At 8:32 AM -0800 1/5/11, David Harkness wrote:
On Wed, Jan 5, 2011 at 8:20 AM, tedd 
<tedd.sperl...@gmail.com> wrote:


I teach using NetBeans, because it generally sucks less than 
Eclipse. Eclipse is simply too complicated and NetBeans tries to be 
less, but it's still too much.



Have you tried PHPStorm?

-snip-

David


David:

Thank you very much for your suggestion.

I spent a couple of hours reviewing PHPStorm and it looks *very* promising!

Not only is it relatively cheap ($49), but they have an option for 
teaching a classroom (they will contact me for details). In short, it 
looks like it was made for me.


Plus, they have versions for both Windozes and Mac. I use Mac 
personally/professionally but am forced to teach programming on 
Windozes. I find that schools are slow to learn when they follow 
Corporate America and Governments as examples of the "right way" to 
do things. Instead they should look at the success of General Motors 
and the State of California for "their way" to handle budgets and 
conclude these examples are not as smart as they should be -- but I 
digress.


The paths required for files (local/remote) are not as obvious as I 
would like, nor does the program actually have control over the 
placement of files (IOW it does NOT allow drag/drop of files and 
folders within the program), but I understand that may be more than 
what they can master for both both platforms. Maybe that will come 
later.


However, it does an automatic update of files that have been changed 
and can run a local and remote execution of the code -- so it is very 
useful.


One of the things that it has over NetBeans and Eclipse is that it 
can provide a review of the files that are on the remote server, 
which was one of my major complaints against both NetBeans and 
Eclipse.


Thanks again.

Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] Newbie Question

2011-01-05 Thread sono-io
On Jan 4, 2011, at 5:27 AM, Steve Staples wrote:

> I now use Komodo (the free version) on my ubuntu workstation, and I love 
> it... I dont know how I managed before.

I use Komodo Edit on OS X and I love it as well, except for the compare 
files feature.  It's the worst one I've ever used.  TextWrangler is far 
superior for file comparisons.

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



Re: [PHP] Newbie Question

2011-01-05 Thread David Harkness
On Wed, Jan 5, 2011 at 10:35 AM, Daniel Brown  wrote:

> On Wed, Jan 5, 2011 at 11:32, David Harkness 
> wrote:
> > I do have to say that NetBeans more than Eclipse will randomly become
> > unusable for unknown reasons: disk and CPU activity spike,
> code-completion
> > lags, whatever. Eclipse seems more solid in this regard.
>
> Whereas, on Linux, I've found the exact opposite to be true:
> NetBeans seemed to work fine, while Eclipse would lock.
>

I used Eclipse on Windows and only a short while on Ubuntu, and I've used
NetBeans exclusively on Ubuntu. I actually switched to using the beta and
now dev builds of NetBeans because of the issues I mentioned. To this day
when I'm editing PHP files, the disk is hit with every keystroke. This
doesn't happen for any other file type such as Java. There's no good reason
that I can think of for that, and it's quite annoying.

   That said, I only use IDE's when I want to see what's new in the
> world, or to see if I could speed up my own development processes at
> all.


There are so many helpful additions to modern IDEs that I miss when I drop
into basic editors. The key is integration. When I'm editing a file, the IDE
shows me which lines have been modified, added, and removed. I can hover
over the indicator to see the original text or revert the change. You can
get this information outside the editor, but I find it speeds up my work to
have it in one place. Of course, I often find myself using grep instead of
the IDE's "find in files" feature. ;) Old habits die hard.

I will admit that I never got to be much of an emacs or vi power user, and
I'd bet they have a lot of the IDE capabilities I have grown to love. I also
have poor vision requiring larger fonts for the main text area, and most
IDEs (GUIs really) provide more tools for me to mitigate the problem than a
fixed terminal.

David


Re: [PHP] Newbie Question

2011-01-05 Thread Robert Cummings

On 11-01-05 01:35 PM, Daniel Brown wrote:

On Wed, Jan 5, 2011 at 11:32, David Harkness  wrote:


I do have to say that NetBeans more than Eclipse will randomly become
unusable for unknown reasons: disk and CPU activity spike, code-completion
lags, whatever. Eclipse seems more solid in this regard.


 Whereas, on Linux, I've found the exact opposite to be true:
NetBeans seemed to work fine, while Eclipse would lock.

 That said, I only use IDE's when I want to see what's new in the
world, or to see if I could speed up my own development processes at
all.  Somehow, I always find myself back to vim, awk, sed, grep, and
the like.  With the exception of a few websites (Gmail usually, but
not always, included), I spend my time on the command line, and have
for years.  GUI's, IDE's, RAD's, and so forth all have their place
with some folks I just don't believe the place is with me.
However, if for nothing else than to stay abreast of things, I'm going
to have to check out PHPStorm.  Until you mentioned it, I'd never even
heard the name.


I'm with you on that. I'm still using a combination of terminals, joe, 
and various command-line tools. Whether I'm local or remote, all of the 
same tools are at my fingertips. In the few cases where I need to work 
in a Windows environment, I just mount the filesystem (for dev anyways) 
over NFS and proceed as usual :)


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] Newbie Question

2011-01-05 Thread Daniel Brown
On Wed, Jan 5, 2011 at 11:32, David Harkness  wrote:
>
> I do have to say that NetBeans more than Eclipse will randomly become
> unusable for unknown reasons: disk and CPU activity spike, code-completion
> lags, whatever. Eclipse seems more solid in this regard.

Whereas, on Linux, I've found the exact opposite to be true:
NetBeans seemed to work fine, while Eclipse would lock.

That said, I only use IDE's when I want to see what's new in the
world, or to see if I could speed up my own development processes at
all.  Somehow, I always find myself back to vim, awk, sed, grep, and
the like.  With the exception of a few websites (Gmail usually, but
not always, included), I spend my time on the command line, and have
for years.  GUI's, IDE's, RAD's, and so forth all have their place
with some folks I just don't believe the place is with me.
However, if for nothing else than to stay abreast of things, I'm going
to have to check out PHPStorm.  Until you mentioned it, I'd never even
heard the name.

-- 

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



Re: [PHP] Newbie Question

2011-01-05 Thread David Harkness
On Wed, Jan 5, 2011 at 8:20 AM, tedd  wrote:

> I teach using NetBeans, because it generally sucks less than Eclipse.
> Eclipse is simply too complicated and NetBeans tries to be less, but it's
> still too much.
>

Have you tried PHPStorm? I installed it but haven't had a chance to play
with it yet. Despite the name, I believe it is designed to handle (X)HTML,
JavaScript, and CSS as well.

I use and prefer Eclipse for Python and Java code, but I found its PHP
support severely lacking the last time I checked (a year ago?). However, at
this new job since I do mostly PHP I stick to NetBeans even when working in
Java occasionally. It's just easier to use the same tool since all the menus
and key commands are just different enough. I can't objectively comment on
which layout is better. I prefer Eclipse, but I used it for a few years
before trying NetBeans and am simply more comfortable with it. Both are
great and horrible at the same time. :)

I do have to say that NetBeans more than Eclipse will randomly become
unusable for unknown reasons: disk and CPU activity spike, code-completion
lags, whatever. Eclipse seems more solid in this regard.

David


Re: [PHP] Newbie Question

2011-01-05 Thread tedd

At 7:43 PM -0600 1/2/11, Larry Garfield wrote:

On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote:

 Thanks for the replies. I'll just put a php on all my html containing php.
 A little of topic. Wich IDE are you guys using. I'm sort of in a catch
 twenty two here. I been alternating vim and dreamweaver. I'm trying to go
 100% open source, but I really find dreamweaver easier to use so far.


I bounce between NetBeans and Eclipse, depending on which currently sucks
less.  I have yet to find a PHP IDE that doesn't suck; it's just degrees of
suckage. :-)

--Larry Garfield



Ain't that the truth.

I use GoLive 9 without all the WYSIWYG nonsense -- DW can be used in 
the same fashion, but it's still bloatware.


I teach using NetBeans, because it generally sucks less than Eclipse. 
Eclipse is simply too complicated and NetBeans tries to be less, but 
it's still too much.


I really don't understand why someone can't make a simple good editor 
(php, css, javascript, html) with a file management system that shows 
both client and server side files. I always feel I am programming 
with one eye closed when using NetBeans.


Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] Newbie Question

2011-01-05 Thread tedd

At 9:36 PM -0300 1/1/11, Adolfo Olivera wrote:

Hi,
I'm new for php. Just trying to get my hello  world going on godaddy
hosting. Can't getting to work. I think sintax it's ok. I was understanding
that my shared hosting plan had php installed. Any suggestions. Thanks,

Happy 2011!!

PS: Please, feel free to educate me on how to address the mailing list,
since again, I'm new to php and not a regular user of mailing lists,


I think it's the sintax -- that's usually left to governments -- try 
syntax instead.


I agree with Ash to simply use .php as the file's suffix. While you 
could use .html, but it's usually hard for newbees to understand 
what's happening.


So, create a file containing:



and save it as myfile.php

Then open your browser and put the url of the file in the address bar 
and you should see Hello World.


If you don't, then post again.

Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] Newbie Question

2011-01-04 Thread Steve Staples
On Sun, 2011-01-02 at 21:10 -0500, David McGlone wrote:
> On Sunday, January 02, 2011 08:43:51 pm Larry Garfield wrote:
> > On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote:
> > > Thanks for the replies. I'll just put a php on all my html containing
> > > php. A little of topic. Wich IDE are you guys using. I'm sort of in a
> > > catch twenty two here. I been alternating vim and dreamweaver. I'm
> > > trying to go 100% open source, but I really find dreamweaver easier to
> > > use so far.
> > 
> > I bounce between NetBeans and Eclipse, depending on which currently sucks
> > less.  I have yet to find a PHP IDE that doesn't suck; it's just degrees of
> > suckage. :-)
> 
> I use Kate. It doesn't suck at all because it doesn't try to do the coding 
> for 
> you :-)
> 
> -- 
> Blessings
> David M.
> 

Personally, for the longest time I used EditPlus++ on windows... used it
for about 4-5 years.  I knew it, I liked it... then i got a job where
they used ZEND (basically Eclipse yes?)  I started to like it once i got
the hang of it... but that job only lasted 3 weeks.  ANYWAY... I now use
Komodo (the free version) on my ubuntu workstation, and I love it... I
dont know how I managed before.

>From my observations and experience, it's all about personal
preferences.  If the one you use works for you, and you like it, then
use it.  I caught flack for some time when I told people I used EditPlus
++ for all my coding, but they just didn't know how to use the features.

Good luck with your coding!  and finding an IDE that works for you! (or
just a standard text editor like VI if you desire)

Steve


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



Re: [PHP] Newbie Question

2011-01-03 Thread Paul M Foster
On Mon, Jan 03, 2011 at 12:03:41PM -0300, Adolfo Olivera wrote:

> Tim,
>I've come to learn that relying on heavy and non free ides for
> developing can kick you in the rear when you have to setup your developement
> enviroment after a while. I've have that problem with some previous projects
> made with adobe flex, asp.net and sql 2008.
> That's the reason why I'm trying to go open source all the way.  But I gotta
> say, I've been trying vim adding a few plugins and I'm having the hardest
> time getting the hang of it. I really miss dreamweaver, I hope the steep
> learning curve pays up later.

Vim's not for everyone. But here's the thing-- once you get it dialed
in, your fingers never have to leave the main keys. Editing is way
faster. And there are just a million key combinations to do things, only
a fraction of which you will use. And those "modes" will drive you crazy
for a while. I still get bitten by them, and I think every Vim user
does. But again, it's way faster.

Also, there's probably not a *nix server in the world which doesn't have
Vi, Vim or the like installed. They may not have nano and they may not
have emacs, but they will have Vi* installed. So your experience with
Vim on the desktop translates into being able to operate on any *nix
server. And there are Vim flavors for Windows as well, if you happen to
be unfortunate enough to be running on an IIS machine.

Paul

-- 
Paul M. Foster
http://noferblatz.com


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



Re: [PHP] Newbie Question

2011-01-03 Thread Ashley Sheridan
On Mon, 2011-01-03 at 10:00 -0500, Mujtaba Arshad wrote:


> I just went back and read the original post and realized the recent
> discussion has nothing to do with it. Awesome.



Yeah, that happens sometimes! The OP changed the subject this time, so
it should be OK ;)

Also, if you can avoid it, please try and avoid top-posting!

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Newbie Question

2011-01-03 Thread Adolfo Olivera
Tim,
   I've come to learn that relying on heavy and non free ides for
developing can kick you in the rear when you have to setup your developement
enviroment after a while. I've have that problem with some previous projects
made with adobe flex, asp.net and sql 2008.
That's the reason why I'm trying to go open source all the way.  But I gotta
say, I've been trying vim adding a few plugins and I'm having the hardest
time getting the hang of it. I really miss dreamweaver, I hope the steep
learning curve pays up later.

El ene 3, 2011 11:50 a.m., "Tim Thorburn"  escribió:

On 1/2/2011 5:56 PM, Adolfo Olivera wrote:
>
> Thanks for the replies. I'll just put a php on all my...
While I may get shot for saying this - I wouldn't worry too much about being
"100% open source".  Use whatever gets the job done, period.  If you're more
comfortable with Dreamweaver, stick with Dreamweaver.  In my day-to-day work
I'll end up using a combination of Dreamweaver, Eclipse, and Notepad++,
along with a little Pico/Nano to do quick edits on the server.  I know a few
people who swear by NetBeans, though I haven't felt the need to try yet
another editor just now.  I tend to prefer an editor that has code
completion - sometimes makes for less typo mistakes and such, but that's
just a personal preference, non-code completion is just as fine.

Now, onto the real debate - editor color scheme and font choices!  (Don't
reply, I know better ... I just had to >.>)


Re: [PHP] Newbie Question

2011-01-03 Thread Mujtaba Arshad
everyone I know who uses dreamweaver does so because the people that are
supervising the project want to use dreamweaver, otherwise I haven't found
anyone who actually liked using it. So I don't know if that actually means
anything but that's the way it is.

I guess it would be important to remember that as long as you clearly
understand what you are doing it hardly matters whether you use notepad or
something much more sophisticated, which also completes a bunch of tasks for
you.

I just went back and read the original post and realized the recent
discussion has nothing to do with it. Awesome.

On Mon, Jan 3, 2011 at 9:50 AM, Tim Thorburn  wrote:

> On 1/2/2011 5:56 PM, Adolfo Olivera wrote:
>
>> Thanks for the replies. I'll just put a php on all my html containing php.
>> A little of topic. Wich IDE are you guys using. I'm sort of in a catch
>> twenty two here. I been alternating vim and dreamweaver. I'm trying to go
>> 100% open source, but I really find dreamweaver easier to use so far.
>>
> While I may get shot for saying this - I wouldn't worry too much about
> being "100% open source".  Use whatever gets the job done, period.  If
> you're more comfortable with Dreamweaver, stick with Dreamweaver.  In my
> day-to-day work I'll end up using a combination of Dreamweaver, Eclipse, and
> Notepad++, along with a little Pico/Nano to do quick edits on the server.  I
> know a few people who swear by NetBeans, though I haven't felt the need to
> try yet another editor just now.  I tend to prefer an editor that has code
> completion - sometimes makes for less typo mistakes and such, but that's
> just a personal preference, non-code completion is just as fine.
>
> Now, onto the real debate - editor color scheme and font choices!  (Don't
> reply, I know better ... I just had to >.>)
>
>


-- 
Mujtaba


Re: [PHP] Newbie Question

2011-01-03 Thread Tim Thorburn

On 1/2/2011 5:56 PM, Adolfo Olivera wrote:

Thanks for the replies. I'll just put a php on all my html containing php.
A little of topic. Wich IDE are you guys using. I'm sort of in a catch
twenty two here. I been alternating vim and dreamweaver. I'm trying to go
100% open source, but I really find dreamweaver easier to use so far.
While I may get shot for saying this - I wouldn't worry too much about 
being "100% open source".  Use whatever gets the job done, period.  If 
you're more comfortable with Dreamweaver, stick with Dreamweaver.  In my 
day-to-day work I'll end up using a combination of Dreamweaver, Eclipse, 
and Notepad++, along with a little Pico/Nano to do quick edits on the 
server.  I know a few people who swear by NetBeans, though I haven't 
felt the need to try yet another editor just now.  I tend to prefer an 
editor that has code completion - sometimes makes for less typo mistakes 
and such, but that's just a personal preference, non-code completion is 
just as fine.


Now, onto the real debate - editor color scheme and font choices!  
(Don't reply, I know better ... I just had to >.>)




Re: [PHP] Newbie Question

2011-01-03 Thread Ashley Sheridan
On Sun, 2011-01-02 at 21:10 -0500, David McGlone wrote:

> On Sunday, January 02, 2011 08:43:51 pm Larry Garfield wrote:
> > On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote:
> > > Thanks for the replies. I'll just put a php on all my html containing
> > > php. A little of topic. Wich IDE are you guys using. I'm sort of in a
> > > catch twenty two here. I been alternating vim and dreamweaver. I'm
> > > trying to go 100% open source, but I really find dreamweaver easier to
> > > use so far.
> > 
> > I bounce between NetBeans and Eclipse, depending on which currently sucks
> > less.  I have yet to find a PHP IDE that doesn't suck; it's just degrees of
> > suckage. :-)
> 
> I use Kate. It doesn't suck at all because it doesn't try to do the coding 
> for 
> you :-)
> 
> -- 
> Blessings
> David M.
> 


Kate is good for basic editing, but I use NetBeans for my main
development, as I like the code hinting it gives you for your own class
and function definitions. Incidentally, you can get Kate working on
Windows if you install KDE on it, which I do at work. It gives me a
setup similar to what I'm most used to at home with my Linux box.

I'd avoid DreamWeaver whatever you do. Unless it's been severely
improved recently, it's not a serious developers tool, more of an
expensive hobbyists. It tries to hint and help too much, which really
gets in the way when you're trying to write code and you know what
you're doing!

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Newbie Question

2011-01-02 Thread David McGlone
On Sunday, January 02, 2011 08:43:51 pm Larry Garfield wrote:
> On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote:
> > Thanks for the replies. I'll just put a php on all my html containing
> > php. A little of topic. Wich IDE are you guys using. I'm sort of in a
> > catch twenty two here. I been alternating vim and dreamweaver. I'm
> > trying to go 100% open source, but I really find dreamweaver easier to
> > use so far.
> 
> I bounce between NetBeans and Eclipse, depending on which currently sucks
> less.  I have yet to find a PHP IDE that doesn't suck; it's just degrees of
> suckage. :-)

I use Kate. It doesn't suck at all because it doesn't try to do the coding for 
you :-)

-- 
Blessings
David M.

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



Re: [PHP] Newbie Question

2011-01-02 Thread Larry Garfield
On Sunday, January 02, 2011 4:56:28 pm Adolfo Olivera wrote:
> Thanks for the replies. I'll just put a php on all my html containing php.
> A little of topic. Wich IDE are you guys using. I'm sort of in a catch
> twenty two here. I been alternating vim and dreamweaver. I'm trying to go
> 100% open source, but I really find dreamweaver easier to use so far.

I bounce between NetBeans and Eclipse, depending on which currently sucks 
less.  I have yet to find a PHP IDE that doesn't suck; it's just degrees of 
suckage. :-)

--Larry Garfield

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



Re: [PHP] Newbie Question

2011-01-02 Thread Joshua Kehn
On Jan 2, 2011, at 5:56 PM, Adolfo Olivera wrote:
> Thanks for the replies. I'll just put a php on all my html containing php.
> A little of topic. Wich IDE are you guys using. I'm sort of in a catch twenty 
> two here. I been alternating vim and dreamweaver. I'm trying to go 100% open 
> source, but I really find dreamweaver easier to use so far.
> 

I use VIM and TextMate exclusively. 

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com



Re: [PHP] Newbie Question

2011-01-02 Thread Adolfo Olivera
Thanks for the replies. I'll just put a php on all my html containing php.
A little of topic. Wich IDE are you guys using. I'm sort of in a catch
twenty two here. I been alternating vim and dreamweaver. I'm trying to go
100% open source, but I really find dreamweaver easier to use so far.

El ene 2, 2011 3:25 p.m., "Joshua Kehn"  escribió:

On Jan 2, 2011, at 1:17 PM, Adam Richardson wrote:
>
> I tend to disagree with Ashley on this topic...
I agree starting with all .php files is good practice for basic sites. I
recommend for applications and bigger then basic project using a decent
framework or main routing file to handle routes for you, instead of
requiring you to manually adjust them if something changes.


Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshu...

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


Re: [PHP] Newbie Question

2011-01-02 Thread Joshua Kehn
On Jan 2, 2011, at 1:17 PM, Adam Richardson wrote:
> 
> I tend to disagree with Ashley on this topic.  For many websites, I'll start
> out making all pages .php, even if they don't require PHP at the moment.
> That's for a couple reasons.
> 
> 1) A few years back, there was certainly a significant performance advantage
> to keeping essentially static pages html.  However, in my current
> benchmarking (using both siege and ab on my Ubuntu servers using apache with
> mod_php), if I use a cache such as APC and a well-configured apache server,
> PHP tends to perform just as well (or sometimes even better) than the html
> version.
> 
> Rasmus has demonstrated similar performance results:
> http://talks.php.net/show/froscon08/24
> 
> 2) I don't want to have to change urls site-wide and set up redirects from
> the old url whenever a page requires adding dynamic capabilities.  By making
> all pages PHP right from the beginning, adding dynamic capabilities is a
> snap as I just add the functionality.
> 
> Adam

I agree starting with all .php files is good practice for basic sites. I 
recommend for applications and bigger then basic project using a decent 
framework or main routing file to handle routes for you, instead of requiring 
you to manually adjust them if something changes.

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com


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



Re: [PHP] Newbie Question

2011-01-02 Thread Adam Richardson
On Sun, Jan 2, 2011 at 12:16 PM, Ashley Sheridan
wrote:

> On Sun, 2011-01-02 at 11:48 -0500, ad...@buskirkgraphics.com wrote:
>
> > Add this to your .htaccess file and HTML files will be handled like PHP
> > files allowing you put PHP in HTML files.
> >
> > AddType application/x-httpd-php .html
> >
> >
>
I wouldn't recommend having .html parsed as PHP though, as it will slow
> down your website/application unnecessarily for any .html files that
> contain no PHP code, as PHP still has to parse the file for any code,
> even if there is none. Leave .html files for static pages that you
> produce with a PHP app for example, or use MOD_REWRITE to reference PHP
> scripts when certain .html files are requested by the browser, as this
> can be a whole lot more specific and selective and won't introduce
> problems later on.
>


I tend to disagree with Ashley on this topic.  For many websites, I'll start
out making all pages .php, even if they don't require PHP at the moment.
 That's for a couple reasons.

1) A few years back, there was certainly a significant performance advantage
to keeping essentially static pages html.  However, in my current
benchmarking (using both siege and ab on my Ubuntu servers using apache with
mod_php), if I use a cache such as APC and a well-configured apache server,
PHP tends to perform just as well (or sometimes even better) than the html
version.

Rasmus has demonstrated similar performance results:
http://talks.php.net/show/froscon08/24

2) I don't want to have to change urls site-wide and set up redirects from
the old url whenever a page requires adding dynamic capabilities.  By making
all pages PHP right from the beginning, adding dynamic capabilities is a
snap as I just add the functionality.

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


Re: [PHP] Newbie Question

2011-01-02 Thread Joshua Kehn
On Jan 2, 2011, at 12:50 PM,  wrote:

> The question was "The .php extension is a requirement?"
> 
> The answer is no.
> 
> While me and Ash may completely disagree on the php parser, the simple answer 
> is there are many ways around running a non .php extension file in php.
> 
> 
> mod_rewrite rules in .htaccess files are interpreted for each request and CAN 
> slow down things if your traffic is high.
> 
> Having said that, mod_rewrite in httpd.conf is faster because it is compiled 
> at server restart and it is native to the server.
> 
> As a beginner, I completely agree with ash on bad practice rule of thumb. You 
> will simply rewrite the html file later on wishing you had never did the hack 
> to make it function. 
> 
> Richard L. Buskirk

> Sorry, here is the code. The .php extension is a requirement? Can't it b 
> embedded on a .html file?

_This_ question when asked from a beginner requires a non-confusing answer of 
"yes." 

> Can't it be embedded on a .html file?

PHP is always embedded alongside HTML code within  tags. It's not 
embedded inside a .html file as the extension should indicate the file type. 
Adding a mod_rewrite rule (as you suggest) can lead to confusion later on in 
development. At the very least you'll look stupid re-asking "Can't it be 
embedded..." 

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com





RE: [PHP] Newbie Question

2011-01-02 Thread admin
The question was "The .php extension is a requirement?"

The answer is no.

While me and Ash may completely disagree on the php parser, the simple answer 
is there are many ways around running a non .php extension file in php.


mod_rewrite rules in .htaccess files are interpreted for each request and CAN 
slow down things if your traffic is high.

Having said that, mod_rewrite in httpd.conf is faster because it is compiled at 
server restart and it is native to the server.

As a beginner, I completely agree with ash on bad practice rule of thumb. You 
will simply rewrite the html file later on wishing you had never did the hack 
to make it function. 







Richard L. Buskirk

-Original Message-
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: Sunday, January 02, 2011 12:16 PM
To: ad...@buskirkgraphics.com
Cc: 'Adolfo Olivera'; 'Joshua Kehn'; robl...@aapt.net.au; 
php-general@lists.php.net
Subject: RE: [PHP] Newbie Question

On Sun, 2011-01-02 at 11:48 -0500, ad...@buskirkgraphics.com wrote:

> Add this to your .htaccess file and HTML files will be handled like PHP
> files allowing you put PHP in HTML files.
> 
> AddType application/x-httpd-php .html
> 
> 
> Richard L. Buskirk
> 
> -Original Message-
> From: Adolfo Olivera [mailto:olivera.ado...@gmail.com] 
> Sent: Saturday, January 01, 2011 8:38 PM
> To: Joshua Kehn
> Cc: robl...@aapt.net.au; php-general@lists.php.net
> Subject: Re: [PHP] Newbie Question
> 
> Sorry, here is the code. The .php extension is a requirement? Can't it b
> embedded on a .html file?
> 
>  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";>   content="text/html; charset=utf-8" /> Untitled Document
>$hello; ?>  
> On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn  wrote:
> 
> > On Jan 1, 2011, at 7:50 PM, David Robley wrote:
> > >
> > > And normally would need to be saved as a .php file so the contents will
> > be
> > > handled by php.
> > >
> > >
> > > Cheers
> > > --
> > > David Robley
> > >
> > > A fool and his money are my two favourite people.
> > > Today is Boomtime, the 2nd day of Chaos in the YOLD 3177.
> >
> > Save the code as hello.php. Copy it to your root web directory (should be
> > the base directory or something called public_html / www when you FTP in)
> > and access it from youdomain.com/hello.php
> >
> > Regards,
> >
> > -Josh
> > 
> > Joshua Kehn | josh.k...@gmail.com
> > http://joshuakehn.com
> >
> >
> 
> 
> -- 
> Adolfo Olivera
> 15-3429-9743
> 
> 


It's really best not to think about embedding PHP in an HTML file, as
that isn't really how it works and it just encourages bad practices.
HTML is embedded inside PHP files, not the other way around. The PHP
parser interprets all the PHP code and creates the necessary output, and
passes that output along with any HTML to the web server to then deliver
to the client (browser). If you embedded PHP inside HTML files, the web
server would have to call up the PHP parser every time you broke in and
out of PHP tags, which wouldn't do at all!

I wouldn't recommend having .html parsed as PHP though, as it will slow
down your website/application unnecessarily for any .html files that
contain no PHP code, as PHP still has to parse the file for any code,
even if there is none. Leave .html files for static pages that you
produce with a PHP app for example, or use MOD_REWRITE to reference PHP
scripts when certain .html files are requested by the browser, as this
can be a whole lot more specific and selective and won't introduce
problems later on.

Thanks,
Ash
http://www.ashleysheridan.co.uk




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



Re: [PHP] Newbie Question

2011-01-02 Thread Joshua Kehn
On Jan 2, 2011, at 11:48 AM,  wrote:

> Add this to your .htaccess file and HTML files will be handled like PHP
> files allowing you put PHP in HTML files.
> 
> AddType application/x-httpd-php .html
> 
> 
> Richard L. Buskirk
> 

I would not recommend this approach, some perfectly valid reasons given by Ash. 
It's the wrong mindset to have.

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com




RE: [PHP] Newbie Question

2011-01-02 Thread Ashley Sheridan
On Sun, 2011-01-02 at 11:48 -0500, ad...@buskirkgraphics.com wrote:

> Add this to your .htaccess file and HTML files will be handled like PHP
> files allowing you put PHP in HTML files.
> 
> AddType application/x-httpd-php .html
> 
> 
> Richard L. Buskirk
> 
> -Original Message-
> From: Adolfo Olivera [mailto:olivera.ado...@gmail.com] 
> Sent: Saturday, January 01, 2011 8:38 PM
> To: Joshua Kehn
> Cc: robl...@aapt.net.au; php-general@lists.php.net
> Subject: Re: [PHP] Newbie Question
> 
> Sorry, here is the code. The .php extension is a requirement? Can't it b
> embedded on a .html file?
> 
>  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";>   content="text/html; charset=utf-8" /> Untitled Document
>$hello; ?>  
> On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn  wrote:
> 
> > On Jan 1, 2011, at 7:50 PM, David Robley wrote:
> > >
> > > And normally would need to be saved as a .php file so the contents will
> > be
> > > handled by php.
> > >
> > >
> > > Cheers
> > > --
> > > David Robley
> > >
> > > A fool and his money are my two favourite people.
> > > Today is Boomtime, the 2nd day of Chaos in the YOLD 3177.
> >
> > Save the code as hello.php. Copy it to your root web directory (should be
> > the base directory or something called public_html / www when you FTP in)
> > and access it from youdomain.com/hello.php
> >
> > Regards,
> >
> > -Josh
> > 
> > Joshua Kehn | josh.k...@gmail.com
> > http://joshuakehn.com
> >
> >
> 
> 
> -- 
> Adolfo Olivera
> 15-3429-9743
> 
> 


It's really best not to think about embedding PHP in an HTML file, as
that isn't really how it works and it just encourages bad practices.
HTML is embedded inside PHP files, not the other way around. The PHP
parser interprets all the PHP code and creates the necessary output, and
passes that output along with any HTML to the web server to then deliver
to the client (browser). If you embedded PHP inside HTML files, the web
server would have to call up the PHP parser every time you broke in and
out of PHP tags, which wouldn't do at all!

I wouldn't recommend having .html parsed as PHP though, as it will slow
down your website/application unnecessarily for any .html files that
contain no PHP code, as PHP still has to parse the file for any code,
even if there is none. Leave .html files for static pages that you
produce with a PHP app for example, or use MOD_REWRITE to reference PHP
scripts when certain .html files are requested by the browser, as this
can be a whole lot more specific and selective and won't introduce
problems later on.

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] Newbie Question

2011-01-02 Thread admin
Add this to your .htaccess file and HTML files will be handled like PHP
files allowing you put PHP in HTML files.

AddType application/x-httpd-php .html


Richard L. Buskirk

-Original Message-
From: Adolfo Olivera [mailto:olivera.ado...@gmail.com] 
Sent: Saturday, January 01, 2011 8:38 PM
To: Joshua Kehn
Cc: robl...@aapt.net.au; php-general@lists.php.net
Subject: Re: [PHP] Newbie Question

Sorry, here is the code. The .php extension is a requirement? Can't it b
embedded on a .html file?

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";>   Untitled Document

On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn  wrote:

> On Jan 1, 2011, at 7:50 PM, David Robley wrote:
> >
> > And normally would need to be saved as a .php file so the contents will
> be
> > handled by php.
> >
> >
> > Cheers
> > --
> > David Robley
> >
> > A fool and his money are my two favourite people.
> > Today is Boomtime, the 2nd day of Chaos in the YOLD 3177.
>
> Save the code as hello.php. Copy it to your root web directory (should be
> the base directory or something called public_html / www when you FTP in)
> and access it from youdomain.com/hello.php
>
> Regards,
>
> -Josh
> 
> Joshua Kehn | josh.k...@gmail.com
> http://joshuakehn.com
>
>


-- 
Adolfo Olivera
15-3429-9743


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



Re: [PHP] Newbie Question

2011-01-01 Thread Joshua Kehn
On Jan 1, 2011, at 8:37 PM, Adolfo Olivera wrote:

> Sorry, here is the code. The .php extension is a requirement? Can't it b 
> embedded on a .html file?
> 
>  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> 
> http://www.w3.org/1999/xhtml";>
> 
> 
> Untitled Document
> 
> 
> 
>  $a = "hello";
> $hello ="Hello Everyone";
> echo $a;
> echo $hello;
> ?>
> 
> 
> 
> On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn  wrote:
> On Jan 1, 2011, at 7:50 PM, David Robley wrote:
> >
> > And normally would need to be saved as a .php file so the contents will be
> > handled by php.
> >
> >
> > Cheers
> > --
> > David Robley
> >
> > A fool and his money are my two favourite people.
> > Today is Boomtime, the 2nd day of Chaos in the YOLD 3177.
> 
> Save the code as hello.php. Copy it to your root web directory (should be the 
> base directory or something called public_html / www when you FTP in) and 
> access it from youdomain.com/hello.php
> 
> Regards,
> 
> -Josh
> 
> Joshua Kehn | josh.k...@gmail.com
> http://joshuakehn.com
> 


Yes it _can_ be embedded alongside HTML code, but it must have the .php 
extension otherwise it won't be picked up as a PHP file. You could add a 
.htaccess rule to change the processing directive (essentially make every HTML 
file a PHP file) but that would be wasteful if you ever serve straight HTML. 

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com



Re: [PHP] Newbie Question

2011-01-01 Thread Adolfo Olivera
Sorry, here is the code. The .php extension is a requirement? Can't it b
embedded on a .html file?

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";>   Untitled Document

On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn  wrote:

> On Jan 1, 2011, at 7:50 PM, David Robley wrote:
> >
> > And normally would need to be saved as a .php file so the contents will
> be
> > handled by php.
> >
> >
> > Cheers
> > --
> > David Robley
> >
> > A fool and his money are my two favourite people.
> > Today is Boomtime, the 2nd day of Chaos in the YOLD 3177.
>
> Save the code as hello.php. Copy it to your root web directory (should be
> the base directory or something called public_html / www when you FTP in)
> and access it from youdomain.com/hello.php
>
> Regards,
>
> -Josh
> 
> Joshua Kehn | josh.k...@gmail.com
> http://joshuakehn.com
>
>


-- 
Adolfo Olivera
15-3429-9743


Re: [PHP] Newbie Question

2011-01-01 Thread Joshua Kehn
On Jan 1, 2011, at 7:50 PM, David Robley wrote:
> 
> And normally would need to be saved as a .php file so the contents will be
> handled by php.
> 
> 
> Cheers
> -- 
> David Robley
> 
> A fool and his money are my two favourite people.
> Today is Boomtime, the 2nd day of Chaos in the YOLD 3177. 

Save the code as hello.php. Copy it to your root web directory (should be the 
base directory or something called public_html / www when you FTP in) and 
access it from youdomain.com/hello.php

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com



Re: [PHP] Newbie Question

2011-01-01 Thread David Robley
Joshua Kehn wrote:

> On Jan 1, 2011, at 7:36 PM, Adolfo Olivera wrote:
> 
>> Hi,
>>I'm new for php. Just trying to get my hello  world going on godaddy
>> hosting. Can't getting to work. I think sintax it's ok. I was
>> understanding that my shared hosting plan had php installed. Any
>> suggestions. Thanks,
>> 
>> Happy 2011!!
>> 
>> PS: Please, feel free to educate me on how to address the mailing list,
>> since again, I'm new to php and not a regular user of mailing lists,
> 
> 
> Can you post the code that you are using?
> 
> It should look something like the following:
> 
> 
> 

And normally would need to be saved as a .php file so the contents will be
handled by php.


Cheers
-- 
David Robley

A fool and his money are my two favourite people.
Today is Boomtime, the 2nd day of Chaos in the YOLD 3177. 


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



Re: [PHP] Newbie Question

2011-01-01 Thread Joshua Kehn
On Jan 1, 2011, at 7:36 PM, Adolfo Olivera wrote:

> Hi,
>I'm new for php. Just trying to get my hello  world going on godaddy
> hosting. Can't getting to work. I think sintax it's ok. I was understanding
> that my shared hosting plan had php installed. Any suggestions. Thanks,
> 
> Happy 2011!!
> 
> PS: Please, feel free to educate me on how to address the mailing list,
> since again, I'm new to php and not a regular user of mailing lists,


Can you post the code that you are using?

It should look something like the following:



Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com


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



Re: [PHP] newbie question about code

2010-09-10 Thread Adam Richardson
On Fri, Sep 10, 2010 at 3:03 PM, Joshua Kehn  wrote:

> Adam-
>
> It is unique. I'm writing code that really can't be done any other way. How
> it handles events, sockets, etc is exceptional. The best part is everything
> now is JavaScript. The server (Node.js) is written in JavaScript. MongoDB is
> JavaScript. The frontend used to manage the WebSocket is entirely
> JavaScript.
>
> I have essentially replaced J2EE as the backend with Node and I couldn't be
> happier.
>
> Of course standard JavaScript woes apply. Debugging is a royal pain in the
> ass. Your code can and will suddenly fail due to odd strange errors. There
> are stability concerns with Node, it is version 0.2 after all.
>
> It won't replace PHP or Java as an enterprise level solution, but it does
> fill in the gaps very nicely.
>
> Regards,
>
> -Josh
>

Thanks for the insights, Josh.

I've been intrigued by Node.js and it's architectural implications, and your
feedback helps as I evaluate potential projects/experiments going forward.
 Excellent point about the debugging relative to other environments.  Palm's
inclusion of Node.js in webOS 2.0 does help provide more confidence in the
code-base, even if it is relatively early in the development cycle, so I
guess I'll have to start tinkering soon :)

Thanks again,

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] newbie question about code

2010-09-10 Thread Joshua Kehn
Adam-

It is unique. I'm writing code that really can't be done any other way. How it 
handles events, sockets, etc is exceptional. The best part is everything now is 
JavaScript. The server (Node.js) is written in JavaScript. MongoDB is 
JavaScript. The frontend used to manage the WebSocket is entirely JavaScript. 

I have essentially replaced J2EE as the backend with Node and I couldn't be 
happier.

Of course standard JavaScript woes apply. Debugging is a royal pain in the ass. 
Your code can and will suddenly fail due to odd strange errors. There are 
stability concerns with Node, it is version 0.2 after all. 

It won't replace PHP or Java as an enterprise level solution, but it does fill 
in the gaps very nicely. 

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com

On Sep 10, 2010, at 2:53 PM, Adam Richardson wrote:

>> 
>> 
>> 
>> This is what I get for taking a week to code everything in Node.js.
>> 
>> 
> 
> It is a Friday, so I'll let my curiosity get the best of me and ask a
> follow-up on something non-PHP.  What insights/impressions do you have
> regarding Node.js after a week of working with it?
> 
> Thanks,
> 
> Adam
> 
> -- 
> Nephtali:  PHP web framework that functions beautifully
> http://nephtaliproject.com


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



Re: [PHP] newbie question about code

2010-09-10 Thread chris h
I would check this out to give you a decent understanding of php's oop.

http://php.net/manual/en/language.oop5.php


Chris.


On Fri, Sep 10, 2010 at 2:27 PM, Adam Williams
wrote:

> I'm looking at someone's code to learn and I'm relatively new to
> programming.  In the code I see commands like:
>
> $code->do_command();
>
> I'm not really sure what that means.  How would that look in procedural
> style programming?  do_command($code); or something else?
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


Re: [PHP] newbie question about code

2010-09-10 Thread Adam Richardson
>
>
>
> This is what I get for taking a week to code everything in Node.js.
>
>

It is a Friday, so I'll let my curiosity get the best of me and ask a
follow-up on something non-PHP.  What insights/impressions do you have
regarding Node.js after a week of working with it?

Thanks,

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] newbie question about code

2010-09-10 Thread tedd

At 2:27 PM -0400 9/10/10, Joshua Kehn wrote:

Adam-

That is a function call. In Java:

class Code
{
public static void function do_command(){ }
}

Code.do_command();

Regards,

-Josh


Not just Java, but does I've seen this in several languages.

Javascript is one. But realize that Java is to Javascript as Ham is 
to Hamster. In other words, the two aren't related.


Cheers,

tedd
--
---
http://sperling.com/

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



Re: [PHP] newbie question about code

2010-09-10 Thread Joshua Kehn
Ash-

Correct, hence my typo and nomenclature slip. ;)

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com

On Sep 10, 2010, at 2:48 PM, a...@ashleysheridan.co.uk wrote:

> Node.js, wouldn't that be javascript rather than java?  :P
> 
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
> 
> - Reply message -
> From: "Joshua Kehn" 
> Date: Fri, Sep 10, 2010 19:32
> Subject: [PHP] newbie question about code
> To: "Bob McConnell" 
> Cc: "Adam Williams" , "PHP General list" 
> 
> 
> 
> Bob-
> 
> Yes, yes I did.
> 
> And note that my Java code is incorrect, that should simply be public static 
> void, no function.
> 
> This is what I get for taking a week to code everything in Node.js. 
> 
> Regards,
> 
> -Josh
> 
> Joshua Kehn | josh.k...@gmail.com
> http://joshuakehn.com
> 
> On Sep 10, 2010, at 2:32 PM, Bob McConnell wrote:
> 
> > Did you mean to say "That is a method call."?
> > 
> > Bob McConnell
> > 
> > -
> > From: Joshua Kehn
> > 
> > That is a function call. In Java:
> > 
> > class Code
> > {
> >public static void function do_command(){ }
> > }
> > 
> > Code.do_command();
> > 
> > Regards,
> > 
> > -Josh
> > 
> > Joshua Kehn | josh.k...@gmail.com
> > http://joshuakehn.com
> > 
> > On Sep 10, 2010, at 2:27 PM, Adam Williams wrote:
> > 
> >> I'm looking at someone's code to learn and I'm relatively new to
> > programming.  In the code I see commands like:
> >> 
> >> $code->do_command();
> >> 
> >> I'm not really sure what that means.  How would that look in
> > procedural style programming?  do_command($code); or something else?
> >> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 



Re: [PHP] newbie question about code

2010-09-10 Thread a...@ashleysheridan.co.uk
Node.js, wouldn't that be javascript rather than java?  :P

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: "Joshua Kehn" 
Date: Fri, Sep 10, 2010 19:32
Subject: [PHP] newbie question about code
To: "Bob McConnell" 
Cc: "Adam Williams" , "PHP General list" 



Bob-

Yes, yes I did.

And note that my Java code is incorrect, that should simply be public static 
void, no function.

This is what I get for taking a week to code everything in Node.js. 

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com

On Sep 10, 2010, at 2:32 PM, Bob McConnell wrote:

> Did you mean to say "That is a method call."?
> 
> Bob McConnell
> 
> -
> From: Joshua Kehn
> 
> That is a function call. In Java:
> 
> class Code
> {
>public static void function do_command(){ }
> }
> 
> Code.do_command();
> 
> Regards,
> 
> -Josh
> 
> Joshua Kehn | josh.k...@gmail.com
> http://joshuakehn.com
> 
> On Sep 10, 2010, at 2:27 PM, Adam Williams wrote:
> 
>> I'm looking at someone's code to learn and I'm relatively new to
> programming.  In the code I see commands like:
>> 
>> $code->do_command();
>> 
>> I'm not really sure what that means.  How would that look in
> procedural style programming?  do_command($code); or something else?
>> 


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



Re: [PHP] newbie question about code

2010-09-10 Thread a...@ashleysheridan.co.uk
It's object oriented code. $code is an instance of class, and do_command() is a 
method if that class. I'd advise reading up on oop php.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: "Adam Williams" 
Date: Fri, Sep 10, 2010 19:27
Subject: [PHP] newbie question about code
To: "PHP General list" 

I'm looking at someone's code to learn and I'm relatively new to 
programming.  In the code I see commands like:

$code->do_command();

I'm not really sure what that means.  How would that look in procedural 
style programming?  do_command($code); or something else?


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



Re: [PHP] newbie question about code

2010-09-10 Thread Joshua Kehn
Bob-

Yes, yes I did.

And note that my Java code is incorrect, that should simply be public static 
void, no function.

This is what I get for taking a week to code everything in Node.js. 

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com

On Sep 10, 2010, at 2:32 PM, Bob McConnell wrote:

> Did you mean to say "That is a method call."?
> 
> Bob McConnell
> 
> -
> From: Joshua Kehn
> 
> That is a function call. In Java:
> 
> class Code
> {
>public static void function do_command(){ }
> }
> 
> Code.do_command();
> 
> Regards,
> 
> -Josh
> 
> Joshua Kehn | josh.k...@gmail.com
> http://joshuakehn.com
> 
> On Sep 10, 2010, at 2:27 PM, Adam Williams wrote:
> 
>> I'm looking at someone's code to learn and I'm relatively new to
> programming.  In the code I see commands like:
>> 
>> $code->do_command();
>> 
>> I'm not really sure what that means.  How would that look in
> procedural style programming?  do_command($code); or something else?
>> 


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



RE: [PHP] newbie question about code

2010-09-10 Thread Bob McConnell
Did you mean to say "That is a method call."?

Bob McConnell

-
From: Joshua Kehn

That is a function call. In Java:

class Code
{
public static void function do_command(){ }
}

Code.do_command();

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com

On Sep 10, 2010, at 2:27 PM, Adam Williams wrote:

> I'm looking at someone's code to learn and I'm relatively new to
programming.  In the code I see commands like:
> 
> $code->do_command();
> 
> I'm not really sure what that means.  How would that look in
procedural style programming?  do_command($code); or something else?
> 

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



Re: [PHP] newbie question about code

2010-09-10 Thread Joshua Kehn
Adam-

That is a function call. In Java:

class Code
{
public static void function do_command(){ }
}

Code.do_command();

Regards,

-Josh

Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com

On Sep 10, 2010, at 2:27 PM, Adam Williams wrote:

> I'm looking at someone's code to learn and I'm relatively new to programming. 
>  In the code I see commands like:
> 
> $code->do_command();
> 
> I'm not really sure what that means.  How would that look in procedural style 
> programming?  do_command($code); or something else?
> 
> 
> -- 
> 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



Re: [PHP] Newbie Question about Conditionals

2010-03-31 Thread Matty Sarro
After looking up the === operator, I see exactly what you mean. Thanks for
your help everyone. I think the confusion was that I was always under the
impression that assignment is either true or false; I would never have
guessed it was equal to the value assigned. Your examples really helped to
solidify the concept though!

PS: I have to say that PHP has the *best* documentation I've ever seen
beside Java.

Thanks again!

On Wed, Mar 31, 2010 at 4:43 AM, Richard Quadling
wrote:

> On 31 March 2010 05:45, Matty Sarro  wrote:
> > That explains it perfectly, thanks you!
> >
> > On Wed, Mar 31, 2010 at 12:40 AM, Tommy Pham  wrote:
> >
> >> On Tue, Mar 30, 2010 at 9:22 PM, Matty Sarro  wrote:
> >> > Hey all!
> >> > This is probably my second post on the list, so please be gentle.
> Right
> >> now
> >> > I am running through the "Heads First PHP and MySQL" book from
> O'Reilly.
> >> > It's been quite enjoyable so far, but I have some questions about some
> of
> >> > the code they're using in one of the chapters.
> >> >
> >> > Basically the code is retreiving rows from a DB, and I'm just not
> getting
> >> > the explanation of how it works.
> >> >
> >> > Here's the code:
> >> >
> >> > $result=mysqli_query($dbc,$query)
> >> >
> >> > while($row=mysqli_fetch_array($result)){
> >> > echo $row['first_name'].' '.$row['last_name'].' : '. $row['email'] .
> ' >> > />';
> >> > }
> >> >
> >> > Now, I know what it does, but I don't understand how the conditional
> >> > statement in the while loop works. Isn't an assignment operation
> always
> >> > going to result in a "true" condition? Even if
> >> mysqli_fetch_array($result)
> >> > returned empty values (or null) wouldn't the actual assignment to $row
> >> still
> >> > be considered a true statement? I would have sworn that assignment
> >> > operations ALWAYS equated to true if used in conditional operations.
> >> > Please help explain! :)
> >> >
> >> > Thanks so much!
> >> > -Matty
> >> >
> >>
> >> http://www.php.net/manual/en/function.mysql-fetch-array.php
> >>
> >> "Returns an array of strings that corresponds to the fetched row, or
> >> FALSE  if there are no more rows."
> >>
> >> while($row=mysqli_fetch_array($result)) is equivalent to this:
> >>
> >> $row=mysqli_fetch_array($result);
> >> while ($row){
> >>
> >> // do something
> >>
> >> $row=mysqli_fetch_array($result);
> >> }
> >>
> >> So, if $row is not equal to FALSE, the loop will happens.
> >>
> >
>
> Another part to the answer is the value of the assignment. From the
> documentation (
> http://docs.php.net/manual/en/language.operators.assignment.php),
> ...
>
> "The value of an assignment expression is the value assigned."
>
> while($row = mysqli_fetch_array($result))
>
>
> But there is a significant issue here. Whilst not attributable to the
> mysqli_fetch_array() function, it is certainly possible to give
> yourself a significant WTF moment with it.
>
>
> May be will be easier to see the problem when the code is written as ...
>
> while(False === ($row = mysqli_fetch_array($result)))
>
> No?
>
>
> If I say ...
>
> 0 == False
>
> does that help?
>
>
>
> Without running the 2 stupid scripts  below, what output should you get?
>
> 
>
> and
>
> 
>
> Clearly, they should be different, yes?
>
> Unfortunately, they won't be.
>
> The first call returns 0 and the second returns False.
>
> And as 0 == False, the while() does not loop.
>
> But ...
>
> 
>
> and
>
> 
>
> now operate correctly. The first one runs forever, printing a's and
> the second one quits straight away.
>
> By always using ...
>
> while(False !== ($var = function($param)))
>
> you can clearly differentiate between functions that return false to
> indicate failure and 0 to indicate a position or actual value.
>
> Regards,
>
> Richard.
>
>
>
>
>
> --
> -
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>


Re: [PHP] Newbie Question about Conditionals

2010-03-31 Thread Richard Quadling
On 31 March 2010 05:45, Matty Sarro  wrote:
> That explains it perfectly, thanks you!
>
> On Wed, Mar 31, 2010 at 12:40 AM, Tommy Pham  wrote:
>
>> On Tue, Mar 30, 2010 at 9:22 PM, Matty Sarro  wrote:
>> > Hey all!
>> > This is probably my second post on the list, so please be gentle. Right
>> now
>> > I am running through the "Heads First PHP and MySQL" book from O'Reilly.
>> > It's been quite enjoyable so far, but I have some questions about some of
>> > the code they're using in one of the chapters.
>> >
>> > Basically the code is retreiving rows from a DB, and I'm just not getting
>> > the explanation of how it works.
>> >
>> > Here's the code:
>> >
>> > $result=mysqli_query($dbc,$query)
>> >
>> > while($row=mysqli_fetch_array($result)){
>> > echo $row['first_name'].' '.$row['last_name'].' : '. $row['email'] . '> > />';
>> > }
>> >
>> > Now, I know what it does, but I don't understand how the conditional
>> > statement in the while loop works. Isn't an assignment operation always
>> > going to result in a "true" condition? Even if
>> mysqli_fetch_array($result)
>> > returned empty values (or null) wouldn't the actual assignment to $row
>> still
>> > be considered a true statement? I would have sworn that assignment
>> > operations ALWAYS equated to true if used in conditional operations.
>> > Please help explain! :)
>> >
>> > Thanks so much!
>> > -Matty
>> >
>>
>> http://www.php.net/manual/en/function.mysql-fetch-array.php
>>
>> "Returns an array of strings that corresponds to the fetched row, or
>> FALSE  if there are no more rows."
>>
>> while($row=mysqli_fetch_array($result)) is equivalent to this:
>>
>> $row=mysqli_fetch_array($result);
>> while ($row){
>>
>> // do something
>>
>> $row=mysqli_fetch_array($result);
>> }
>>
>> So, if $row is not equal to FALSE, the loop will happens.
>>
>

Another part to the answer is the value of the assignment. From the
documentation (http://docs.php.net/manual/en/language.operators.assignment.php),
...

"The value of an assignment expression is the value assigned."

while($row = mysqli_fetch_array($result))


But there is a significant issue here. Whilst not attributable to the
mysqli_fetch_array() function, it is certainly possible to give
yourself a significant WTF moment with it.


May be will be easier to see the problem when the code is written as ...

while(False === ($row = mysqli_fetch_array($result)))

No?


If I say ...

0 == False

does that help?



Without running the 2 stupid scripts  below, what output should you get?



and



Clearly, they should be different, yes?

Unfortunately, they won't be.

The first call returns 0 and the second returns False.

And as 0 == False, the while() does not loop.

But ...



and



now operate correctly. The first one runs forever, printing a's and
the second one quits straight away.

By always using ...

while(False !== ($var = function($param)))

you can clearly differentiate between functions that return false to
indicate failure and 0 to indicate a position or actual value.

Regards,

Richard.





-- 
-
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Newbie Question about Conditionals

2010-03-30 Thread Matty Sarro
That explains it perfectly, thanks you!

On Wed, Mar 31, 2010 at 12:40 AM, Tommy Pham  wrote:

> On Tue, Mar 30, 2010 at 9:22 PM, Matty Sarro  wrote:
> > Hey all!
> > This is probably my second post on the list, so please be gentle. Right
> now
> > I am running through the "Heads First PHP and MySQL" book from O'Reilly.
> > It's been quite enjoyable so far, but I have some questions about some of
> > the code they're using in one of the chapters.
> >
> > Basically the code is retreiving rows from a DB, and I'm just not getting
> > the explanation of how it works.
> >
> > Here's the code:
> >
> > $result=mysqli_query($dbc,$query)
> >
> > while($row=mysqli_fetch_array($result)){
> > echo $row['first_name'].' '.$row['last_name'].' : '. $row['email'] . ' > />';
> > }
> >
> > Now, I know what it does, but I don't understand how the conditional
> > statement in the while loop works. Isn't an assignment operation always
> > going to result in a "true" condition? Even if
> mysqli_fetch_array($result)
> > returned empty values (or null) wouldn't the actual assignment to $row
> still
> > be considered a true statement? I would have sworn that assignment
> > operations ALWAYS equated to true if used in conditional operations.
> > Please help explain! :)
> >
> > Thanks so much!
> > -Matty
> >
>
> http://www.php.net/manual/en/function.mysql-fetch-array.php
>
> "Returns an array of strings that corresponds to the fetched row, or
> FALSE  if there are no more rows."
>
> while($row=mysqli_fetch_array($result)) is equivalent to this:
>
> $row=mysqli_fetch_array($result);
> while ($row){
>
> // do something
>
> $row=mysqli_fetch_array($result);
> }
>
> So, if $row is not equal to FALSE, the loop will happens.
>


Re: [PHP] Newbie Question about Conditionals

2010-03-30 Thread Tommy Pham
On Tue, Mar 30, 2010 at 9:22 PM, Matty Sarro  wrote:
> Hey all!
> This is probably my second post on the list, so please be gentle. Right now
> I am running through the "Heads First PHP and MySQL" book from O'Reilly.
> It's been quite enjoyable so far, but I have some questions about some of
> the code they're using in one of the chapters.
>
> Basically the code is retreiving rows from a DB, and I'm just not getting
> the explanation of how it works.
>
> Here's the code:
>
> $result=mysqli_query($dbc,$query)
>
> while($row=mysqli_fetch_array($result)){
> echo $row['first_name'].' '.$row['last_name'].' : '. $row['email'] . ' />';
> }
>
> Now, I know what it does, but I don't understand how the conditional
> statement in the while loop works. Isn't an assignment operation always
> going to result in a "true" condition? Even if mysqli_fetch_array($result)
> returned empty values (or null) wouldn't the actual assignment to $row still
> be considered a true statement? I would have sworn that assignment
> operations ALWAYS equated to true if used in conditional operations.
> Please help explain! :)
>
> Thanks so much!
> -Matty
>

http://www.php.net/manual/en/function.mysql-fetch-array.php

"Returns an array of strings that corresponds to the fetched row, or
FALSE  if there are no more rows."

while($row=mysqli_fetch_array($result)) is equivalent to this:

$row=mysqli_fetch_array($result);
while ($row){

// do something

$row=mysqli_fetch_array($result);
}

So, if $row is not equal to FALSE, the loop will happens.

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



Re: [PHP] Newbie Question: How to pass URL info to .php script ?

2008-06-19 Thread Chris Scott
You could just use an apache (or other web server) alias:

 

www.test.com/article -> www.test.com/article.php

 

where article.php uses:

 

";

?>



Re: [PHP] Newbie Question: How to pass URL info to .php script ?

2008-06-19 Thread Nathan Nobbe
On Thu, Jun 19, 2008 at 1:18 AM, Ethan Whitt <[EMAIL PROTECTED]>
wrote:

> I pasted your example in and it doesn't work for me (again, newbie).  I
> will play with it and see if I can get it working.  My main goal is to have
> Ruby-like URL's vs "?var=3425".  Is this possible with .php (without
> mod_rewrite / something in the http server?)


i just typed it into the browser so it could have some mistakes.  well to
answer your question, yes, you can use external redirects from php, and if
you store the query string (part of url past ?) then it can be made
accessible to whatever file youve redirected the client to.  so like, a
client request a page, say,

http://youresite.com/somedir?a=5&b=6

in somedir, on your webserver, you just put an index.php file.  then in
there, you do something like put the values $_GET['a'] and $_GET['b'] in
some persistent storage, like $_SESSION, a db, or just in a file somewhere.
then you use header to redirect the client to a url that doenst have the
query string, something like

if(!empty($_GET)) {
  /// store $_GET vars
  header('Location: http://yoursite.com/somedir');
} else {
  /// check storage location for vars to load
  /// make sure to filter said vars !
}

while this approach is effective, i consider it messy / inefficient /
cumbersome, and personally favor mod_rewrite.  if you look into code igniter
or other frameworks, you can see how they are managing the implementation of
pretty urls.  most of them will favor mod_rewrite, but offer an alternative
for people who dont want to use it or dont have access to it (because of
hosting provider for example).  so you might dig into some open source code
for a nice tested solution to your problem.

and digging through open source code can just be so much fun ;D

-nathan


Re: [PHP] Newbie Question: How to pass URL info to .php script ?

2008-06-19 Thread Nathan Nobbe
On Thu, Jun 19, 2008 at 1:28 AM, Bob <[EMAIL PROTECTED]> wrote:

> Have you tried CodeIgniter http://www.codeigniter.com?
>
> Not as restrictive as many MVC frameworks and very easy to work with.
>
> What you wish to achieve can be done with one line.
>
> $myvar = $this->uri->segment(2);


right, and if you look at the implementation there, you can see usage of
mod_rewrite and the $_SERVER array.  what i was trying to convey is that OP
will need some way to access the url that has been requested by the client.
the $_SERVER array is the only way i know of; if there are other ways im
always up for learning something new.

-nathan


Re: [PHP] Newbie Question: How to pass URL info to .php script ?

2008-06-19 Thread Jignesh Thummar
Ethan,
you can try this:
$url = www.test.com/article/3435;
echo basename($url);

another solution is that you can use explode() function to seprate your url
from '/' or you can use regex to parse your url

- Jignesh
On Thu, Jun 19, 2008 at 8:18 AM, Ethan Whitt <[EMAIL PROTECTED]>
wrote:

> I pasted your example in and it doesn't work for me (again, newbie).  I
> will
> play with it and see if I can get it working.  My main goal is to have
> Ruby-like URL's vs "?var=3425".  Is this possible with .php (without
> mod_rewrite / something in the http server?)
> Thanks,
>
> Ethan
>
>
>
>
> On Wed, Jun 18, 2008 at 9:59 PM, Nathan Nobbe <[EMAIL PROTECTED]>
> wrote:
>
> > On Wed, Jun 18, 2008 at 10:45 PM, Ethan Whitt <[EMAIL PROTECTED]>
> > wrote:
> >
> >> Not sure how to achieve this.  How can I grab a portion of a URl to send
> >> to
> >> a .php script in this fashion?
> >>
> >> www.test.com/article/3435   <- Grab the "3435" to process in a script?
> >
> >
> > take a look at the $_SERVER superglobal array,
> >
> > http://www.php.net/manual/en/reserved.variables.server.php
> >
> > most likely you are looking for, $_SERVER['PATH_TRANSLATED'], but it
> really
> > depends on what you want out of the url, so make sure to read through the
> > options, and their explanations.  those values are just strings, so its
> > quite easy to extract portions of the string using a variety of
> techniques.
> > for example, give the url in your question (suppose we find it in
> > $_SERVER['PATH_TRANSLATED'])
> >
> > $lastPath = substr($_SERVER['PATH_TRANSLATED'],
> > strrpos($_SERVER['PATH_TRANSLATED']), '/') + 1); // $lastPath = '3435'
> >
> > -nathan
> >
>


RE: [PHP] Newbie Question: How to pass URL info to .php script ?

2008-06-19 Thread Bob
Have you tried CodeIgniter http://www.codeigniter.com?

Not as restrictive as many MVC frameworks and very easy to work with.

What you wish to achieve can be done with one line.

$myvar = $this->uri->segment(2);

http://codeigniter.com/user_guide/libraries/uri.html

Likely not to everyone's taste but on a personal level I think it's one of
the better MVCs about.
 
Bob.

-Original Message-
From: Ethan Whitt
Sent: 19 June 2008 17:19
To: Nathan Nobbe
Cc: php-general@lists.php.net
Subject: Re: [PHP] Newbie Question: How to pass URL info to .php script ?

I pasted your example in and it doesn't work for me (again, newbie).  I will
play with it and see if I can get it working.  My main goal is to have
Ruby-like URL's vs "?var=3425".  Is this possible with .php (without
mod_rewrite / something in the http server?)
Thanks,

Ethan




On Wed, Jun 18, 2008 at 9:59 PM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:

> On Wed, Jun 18, 2008 at 10:45 PM, Ethan Whitt <[EMAIL PROTECTED]>
> wrote:
>
>> Not sure how to achieve this.  How can I grab a portion of a URl to send
>> to
>> a .php script in this fashion?
>>
>> www.test.com/article/3435   <- Grab the "3435" to process in a script?
>
>
> take a look at the $_SERVER superglobal array,
>
> http://www.php.net/manual/en/reserved.variables.server.php
>
> most likely you are looking for, $_SERVER['PATH_TRANSLATED'], but it
really
> depends on what you want out of the url, so make sure to read through the
> options, and their explanations.  those values are just strings, so its
> quite easy to extract portions of the string using a variety of
techniques.
> for example, give the url in your question (suppose we find it in
> $_SERVER['PATH_TRANSLATED'])
>
> $lastPath = substr($_SERVER['PATH_TRANSLATED'],
> strrpos($_SERVER['PATH_TRANSLATED']), '/') + 1); // $lastPath = '3435'
>
> -nathan
>


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



Re: [PHP] Newbie Question: How to pass URL info to .php script ?

2008-06-19 Thread Ethan Whitt
I pasted your example in and it doesn't work for me (again, newbie).  I will
play with it and see if I can get it working.  My main goal is to have
Ruby-like URL's vs "?var=3425".  Is this possible with .php (without
mod_rewrite / something in the http server?)
Thanks,

Ethan




On Wed, Jun 18, 2008 at 9:59 PM, Nathan Nobbe <[EMAIL PROTECTED]>
wrote:

> On Wed, Jun 18, 2008 at 10:45 PM, Ethan Whitt <[EMAIL PROTECTED]>
> wrote:
>
>> Not sure how to achieve this.  How can I grab a portion of a URl to send
>> to
>> a .php script in this fashion?
>>
>> www.test.com/article/3435   <- Grab the "3435" to process in a script?
>
>
> take a look at the $_SERVER superglobal array,
>
> http://www.php.net/manual/en/reserved.variables.server.php
>
> most likely you are looking for, $_SERVER['PATH_TRANSLATED'], but it really
> depends on what you want out of the url, so make sure to read through the
> options, and their explanations.  those values are just strings, so its
> quite easy to extract portions of the string using a variety of techniques.
> for example, give the url in your question (suppose we find it in
> $_SERVER['PATH_TRANSLATED'])
>
> $lastPath = substr($_SERVER['PATH_TRANSLATED'],
> strrpos($_SERVER['PATH_TRANSLATED']), '/') + 1); // $lastPath = '3435'
>
> -nathan
>


Re: [PHP] Newbie Question: How to pass URL info to .php script ?

2008-06-18 Thread Nathan Nobbe
On Wed, Jun 18, 2008 at 10:45 PM, Ethan Whitt <[EMAIL PROTECTED]>
wrote:

> Not sure how to achieve this.  How can I grab a portion of a URl to send to
> a .php script in this fashion?
>
> www.test.com/article/3435   <- Grab the "3435" to process in a script?


take a look at the $_SERVER superglobal array,

http://www.php.net/manual/en/reserved.variables.server.php

most likely you are looking for, $_SERVER['PATH_TRANSLATED'], but it really
depends on what you want out of the url, so make sure to read through the
options, and their explanations.  those values are just strings, so its
quite easy to extract portions of the string using a variety of techniques.
for example, give the url in your question (suppose we find it in
$_SERVER['PATH_TRANSLATED'])

$lastPath = substr($_SERVER['PATH_TRANSLATED'],
strrpos($_SERVER['PATH_TRANSLATED']), '/') + 1); // $lastPath = '3435'

-nathan


Re: [PHP] Newbie question about sending email

2008-04-17 Thread Daniel Brown
On Thu, Apr 17, 2008 at 12:50 PM, Pete Holsberg <[EMAIL PROTECTED]> wrote:
>
>  1E6 thank yous!!

My TI SR-10 couldn't handle that calculation and blew up in my hand.  ;-P

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Newbie question about sending email

2008-04-17 Thread Pete Holsberg

Ooops!

processor.php is now:


$where_form_is = 
"http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/";


$to = "[EMAIL PROTECTED],[EMAIL PROTECTED]";
$subject = "SUBSCRIBE";
//$from = $_POST['field_4'];  <<<== this was the culprit
$body = "Form data:

Name: ".$_POST['field_1']."
Street Address: ".$_POST['field_2']."
Phone Number: ".$_POST['field_3']."
Email Address: ".$_POST['field_4']."

powered by phpFormGenerator, but fixed by PHP-General!";

$headers  = "From: \"".$_POST['field_1']."\" <".$_POST['field_4'].">\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";

mail($to, $from, $subject, $body);

include("confirm.html");
?>

AND IT WORKS!!

1E6 thank yous!!

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



Re: [PHP] Newbie question about sending email

2008-04-17 Thread Daniel Brown
On Thu, Apr 17, 2008 at 12:37 PM, Pete Holsberg <[EMAIL PROTECTED]> wrote:
>
>  OK. I don't see a mail() in your code. Would it be
>
>  mail($to, $subject, $body, $headers);
>
>  ?

Entirely my fault, Pete.  I'm a moron sometimes.  Could've sworn
it was in there.  Sorry about that.

Yes, you've got it exactly right.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Newbie question about sending email

2008-04-17 Thread Pete Holsberg

Daniel Brown has written on 4/17/2008 12:29 PM:

I'll reiterate:
   "Note the mail() parameters.  There's no header information there."
RTFM: http://php.net/mail

You just have your mail() function wrong.  Reiterating my code as
well (with updated field_4 data):

http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/";
$to = "[EMAIL PROTECTED],[EMAIL PROTECTED]";
$subject = "SUBSCRIBE";
$from = $_POST['field_4'];
$body = "Form data:

Name: ".$_POST['field_1']."
Street Address: ".$_POST['field_2']."
Phone Number: ".$_POST['field_3']."
Email Address: ".$_POST['field_4']."

powered by phpFormGenerator, but fixed by PHP-General!";

$headers  = "From: \"".$_POST['field_1']."\" <".$_POST['field_4'].">\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";

include("confirm.html");

?>


OK. I don't see a mail() in your code. Would it be

mail($to, $subject, $body, $headers);

?

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



Re: [PHP] Newbie question about sending email

2008-04-17 Thread Daniel Brown
On Thu, Apr 17, 2008 at 12:17 PM, Pete Holsberg <[EMAIL PROTECTED]> wrote:
[snip!]
>
>  OK. Here's what I have now for processor.php:
>
>
>  
>  //
> $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
>
>  $where_form_is =
> "http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/";
>
>  if (mail($to, $from, $subject, $body)) {
>   echo("Message successfully sent!");
>  } else {
>   echo("Message delivery failed...");
>
>  }
[snip!]

I'll reiterate:
   "Note the mail() parameters.  There's no header information there."
RTFM: http://php.net/mail

You just have your mail() function wrong.  Reiterating my code as
well (with updated field_4 data):

http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/";
$to = "[EMAIL PROTECTED],[EMAIL PROTECTED]";
$subject = "SUBSCRIBE";
$from = $_POST['field_4'];
$body = "Form data:

Name: ".$_POST['field_1']."
Street Address: ".$_POST['field_2']."
Phone Number: ".$_POST['field_3']."
Email Address: ".$_POST['field_4']."

powered by phpFormGenerator, but fixed by PHP-General!";

$headers  = "From: \"".$_POST['field_1']."\" <".$_POST['field_4'].">\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";

include("confirm.html");

?>


-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Newbie question about sending email

2008-04-17 Thread Pete Holsberg

Daniel Brown has written on 4/16/2008 5:20 PM:

On Wed, Apr 16, 2008 at 5:14 PM, Pete Holsberg <[EMAIL PROTECTED]> wrote:
  

 Why do I need both from_addr and field_4 (Email Address)? Could I just use

 $from = $_POST['field_4']?



Sorry, I noticed it after I started rewriting the form processor,
and then forgot to edit the email accordingly.

That's correct.  Where I placed the $_POST['from_addr'] stuff,
just replace it with $_POST['field_4'].  And then, of course, you can
ignore the HTML field-adding section of my previous email


OK. Here's what I have now for processor.php:

//
$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));


$where_form_is = 
"http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/";


if (mail($to, $from, $subject, $body)) {
 echo("Message successfully sent!");
} else {
 echo("Message delivery failed...");
}

$to = "[EMAIL PROTECTED],[EMAIL PROTECTED]";
$subject = "SUBSCRIBE";
$from = $_POST['field_4'];
$body = "Form data:

Name: ".$_POST['field_1']."
Street Address: ".$_POST['field_2']."
Phone Number: ".$_POST['field_3']."
Email Address: ".$_POST['field_4']."

powered by phpFormGenerator, but fixed by PHP-General!";

$headers  = "From: \"".$_POST['field_1']."\" <".$_POST['from_addr'].">\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";

include("confirm.html");

?>

I don't get either of the echo statements, and the emails are not being 
delivered.


What did I omit?

Thanks.

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



Re: [PHP] Newbie question about sending email

2008-04-16 Thread Daniel Brown
On Wed, Apr 16, 2008 at 5:14 PM, Pete Holsberg <[EMAIL PROTECTED]> wrote:
>
>  Why do I need both from_addr and field_4 (Email Address)? Could I just use
>
>  $from = $_POST['field_4']?

Sorry, I noticed it after I started rewriting the form processor,
and then forgot to edit the email accordingly.

That's correct.  Where I placed the $_POST['from_addr'] stuff,
just replace it with $_POST['field_4'].  And then, of course, you can
ignore the HTML field-adding section of my previous email.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Newbie question about sending email

2008-04-16 Thread Pete Holsberg

Daniel Brown has written on 4/16/2008 4:56 PM:

On Wed, Apr 16, 2008 at 4:39 PM, Pete Holsberg <[EMAIL PROTECTED]> wrote:
  

 The entire processor.php file is:

 http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

 mail("[EMAIL PROTECTED],[EMAIL PROTECTED]","SUBSCRIBE","Form
data:

 Name: " . $_POST['field_1'] . "
 Street Address: " . $_POST['field_2'] . "
 Phone Number: " . $_POST['field_3'] . "
 Email Address: " . $_POST['field_4'] . "


 powered by phpFormGenerator.
 ");

 include("confirm.html");

 ?>



Note the mail() parameters.  There's no header information there.

In your HTML form, add the following field (dress up the HTML as
needed to fit with your form):



Then, change the email processing code to the following:

http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/";
$to = "[EMAIL PROTECTED],[EMAIL PROTECTED]";
$subject = "SUBSCRIBE";
$from = $_POST['from_addr'];
$body = "Form data:

Name: ".$_POST['field_1']."
Email: ".$_POST['from_addr']."
Street Address: ".$_POST['field_2']."
Phone Number: ".$_POST['field_3']."
Email Address: ".$_POST['field_4']."
  



Why do I need both from_addr and field_4 (Email Address)? Could I just use

$from = $_POST['field_4']?

Thanks.


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



Re: [PHP] Newbie question about sending email

2008-04-16 Thread Daniel Brown
On Wed, Apr 16, 2008 at 4:39 PM, Pete Holsberg <[EMAIL PROTECTED]> wrote:
>
>  The entire processor.php file is:
>
>  
>
> $where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
>
>  mail("[EMAIL PROTECTED],[EMAIL PROTECTED]","SUBSCRIBE","Form
> data:
>
>  Name: " . $_POST['field_1'] . "
>  Street Address: " . $_POST['field_2'] . "
>  Phone Number: " . $_POST['field_3'] . "
>  Email Address: " . $_POST['field_4'] . "
>
>
>  powered by phpFormGenerator.
>  ");
>
>  include("confirm.html");
>
>  ?>

Note the mail() parameters.  There's no header information there.

In your HTML form, add the following field (dress up the HTML as
needed to fit with your form):



Then, change the email processing code to the following:

http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."/";
$to = "[EMAIL PROTECTED],[EMAIL PROTECTED]";
$subject = "SUBSCRIBE";
$from = $_POST['from_addr'];
$body = "Form data:

Name: ".$_POST['field_1']."
Email: ".$_POST['from_addr']."
Street Address: ".$_POST['field_2']."
Phone Number: ".$_POST['field_3']."
Email Address: ".$_POST['field_4']."

powered by phpFormGenerator, but fixed by PHP-General!";

$headers  = "From: \"".$_POST['field_1']."\" <".$_POST['from_addr'].">\r\n";
$headers .= "X-Mailer: PHP/".phpversion()."\r\n";

include("confirm.html");

?>

Keep in mind, though, that there's no validation and no SPAM
protection there, but if you're letting Yahoo! manage the group, it's
not *quite* as big of a deal.  You may notice SPAM coming through to
the @pobox.com address from the form though.

-- 

Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] Newbie question about sending email

2008-04-16 Thread Pete Holsberg

Daniel Brown has written on 4/16/2008 4:04 PM:

On Wed, Apr 16, 2008 at 3:53 PM, Pete Holsberg <[EMAIL PROTECTED]> wrote:
  

I wanted a form for people in my community to use to subscribe to a yahoo
group that I run.

 Not being a PHP programmer, I created the form with phpFormGenerator from
SourceForge.

 It works fine except that the email that gets sent to yahoo appears to come
from my web host's domain!

 How can I change things so that the email appears to come from the email
address that is entered in the form?



Make sure that the From:, Reply-To:, and Return-Path: headers are
correctly set in the form processing code, that the headers in general
are properly constructed, and that your host allows aliased sending by
configuration (some MTA configurations only allow a single address, to
reduce SPAM and such).


The entire processor.php file is:

http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

mail("[EMAIL PROTECTED],[EMAIL PROTECTED]","SUBSCRIBE","Form 
data:


Name: " . $_POST['field_1'] . "
Street Address: " . $_POST['field_2'] . "
Phone Number: " . $_POST['field_3'] . "
Email Address: " . $_POST['field_4'] . "


powered by phpFormGenerator.
");

include("confirm.html");

?>

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



Re: [PHP] Newbie question about sending email

2008-04-16 Thread Daniel Brown
On Wed, Apr 16, 2008 at 3:53 PM, Pete Holsberg <[EMAIL PROTECTED]> wrote:
> I wanted a form for people in my community to use to subscribe to a yahoo
> group that I run.
>
>  Not being a PHP programmer, I created the form with phpFormGenerator from
> SourceForge.
>
>  It works fine except that the email that gets sent to yahoo appears to come
> from my web host's domain!
>
>  How can I change things so that the email appears to come from the email
> address that is entered in the form?

Make sure that the From:, Reply-To:, and Return-Path: headers are
correctly set in the form processing code, that the headers in general
are properly constructed, and that your host allows aliased sending by
configuration (some MTA configurations only allow a single address, to
reduce SPAM and such).

-- 

Ask me about:
Dedicated servers starting @ $59.99/mo., VPS starting @ $19.99/mo.,
and shared hosting starting @ $2.50/mo.
Unmanaged, managed, and fully-managed!

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



Re: [PHP] Newbie question, Which way is best?

2008-03-20 Thread Philip Thompson

On Mar 20, 2008, at 12:05 PM, George Jamieson wrote:


Hi Philip,

Hope you don't mind me sending this to you direct. Thanks for the  
answer

but... I'm sorry I don't follow you.

My form sets up the query parameters. It works.

My pagination code passes the page no. It works.

What it doesn't do is provide the next execution of my script with the
query. I pass the page no. but how do I either use the same query  
but with
new LIMIT parameters or reconstruct the entire query with the new  
LIMIT.


My form gives the user options to search by manufacturer, gategory  
or search
string. sorted by description, finish or price. I've just added a  
drop down

box for number of items to be displayed at a time.

I want to use my pagination script to scroll, page by page, through  
the
resultset. So if I call my script again, with the new page number, I  
have no
way of reusing the same query as the user is not required to rePOST  
the form

with its parameters.

I can't see how your code allows me to do that.


Because I increment the page count ($page) each time... So, each time  
you hit Go, then it finds the next page. Of course, this is not really  
made for production - you would want to find a more user-friendly way  
to accomplish showing a result set.


You could change it up to use _GET instead:

Go to Page 3

Then modify your PHP code to accept _GET values along with/instead of  
_POST values:


$page = $_POST['page'] ? (int) $_POST['page'] : (int)  
$_GET['page'];

...
}
?>

I feel like we've explained this fairly well, but you may not  
completely understand. Let us know if we need to break it down a  
little bit more. We would be happy to point you to some materials that  
can assist you.


~Philip



Regards
George


to the called script?


George


I don't know if anyone has answered the question you have asked at
least twice... "How do I pass the query to the next page?" Here's how
I would approach it. Don't pass the query - all you need is the page
number. This code hasn't been tested, but I think you'll get the  
idea.



...





...




Hopefully that helps a little bit.

~Philip


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



Re: [PHP] newbie question about one php script passing control to another

2008-03-20 Thread tedd

At 12:08 PM -0400 3/20/08, Rod Clay wrote:
Hello.  I am new to php programming, but have spent many years 
programming in many other languages, most recently perl (with which 
php seems to have much in common!).  In every other language I've 
worked with there is a way for one program to pass control to 
another.  However, so far in all of the books and other 
documentation I've looked at for php, I cannot find a way for one 
php program to pass control to another.  Is this possible in php, 
and, if so, please let me know how.  Thank you.


Rod Clay
[EMAIL PROTECTED]


Rod:

If what you mean is one program to launch another, then look at this:

http://webbytedd.com/bb/php-run-php/

If you want to pass variables, there's several ways to do that -- 
but, that's a different question.


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] newbie question about one php script passing control to another

2008-03-20 Thread Rick Pasotto
On Thu, Mar 20, 2008 at 12:08:39PM -0400, Rod Clay wrote:
> Hello.  I am new to php programming, but have spent many years
> programming in many other languages, most recently perl (with which
> php  seems to have much in common!).  In every other language I've
> worked  with there is a way for one program to pass control to
> another.   However, so far in all of the books and other documentation
> I've looked  at for php, I cannot find a way for one php program to
> pass control to  another.  Is this possible in php, and, if so, please
> let me know how.   Thank you.

This may be what you are looking for:

include('next_program');
exit();

If you do this, you have to keep in mind that all the variables you set
in the first program are *still* set in the second.

This is useful when your first program needs to choose which of two or
more programs to run next depending on its calculations. For example, if
your first program does error checking then it might want to run an
all_ok program or an edit program.

-- 
"To be without a plan is the true genius and glory of the antislavery
 movement. The mission of that movement is to preach eternal truths, and
 to  bear witness to everlasting testimony against the giant falsehoods
 which bewitch and enslave the land." -- Nathaniel Peabody Rogers
Rick Pasotto[EMAIL PROTECTED]http://www.niof.net

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



Re: [PHP] Newbie question, Which way is best?

2008-03-20 Thread George J
Hi Shawn,

>> My query code-
>>
>> ---SQL query construction block
>>   $query = "SELECT * FROM prods ";
>>   if($catagory != 0){ 
>> //
>> if category != 0
>>  $where="WHERE c = $catagory ";
>>  if ($manu != 0){  // 
>> check
>> manu != 0
>> $and = "AND m = $manu ";
>> if ($searchstring != 0){
>>$and = $and."AND description LIKE \"%$searchstring%\" "; 
>> //
>> check like != 0
>> }
>>  }else{
>> ...
>> $query=$query.$where.$and.$like
>>
>> ---
>> Can you please explain your suggestion above in laymans terms. I can't 
>> see
>> what you have in mind. Is it your suggestion to use one script, 
>> containing a
>> from, that calls another script that handles my query construction? That 
>> far
>> I follow you but what happens next?
>>
>>
>>
> What file is this?  is the pagination code in this file also?  If not
> where?  Post you pagination code and this is a simple explanation.
>
> Build your query as you've done and stick it in a session var.  It is
> now available to future calls to this page or other pages.
>
> -Shawn

The above code was included in post to show how query is constructed.

Heres my pagination code.
---
if($page > 1){ // if number of pages > 1 then display 'Previous' button
$pageprev = $page-1;
   echo(" ");
}else{
echo(" ");
}
//
$numpages = $totalrows / $show; //$show holds number of items to display per 
page
// display a button for each page with current page showing disabled button
for($i = 1; $i <= $numpages; $i++){
   $str1="btn_";
   $str2=$i;
if($i == $page){
 $str3=$str1.$str2."disabled.gif";
  echo(" ");
}else{
 $str3=$str1.$str2."_enabled.gif";
echo(" ");
 }
}
// if last page is less than full
if(($totalrows % $show) != 0){
   $str2=$i;
  if($i == $page){
 $str3=$str1.$str2."disabled.gif";
  echo(" ");//$i ");
}else{
 $str3=$str1.$str2."enabled.gif";
  echo(" ");//$i ");
}
}
// Display the enabled or disabled 'Next' button
if(($totalrows - ($show * $page)) > 0){
  //$str3=$str1.$str2."disabled.gif";
$pagenext =$page+1;
echo("");//$i ");
}else{
   $pagenext =$page+1;
echo(" 
");
}
?>

---

Thanks for sticking with me.

George



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



Re: [PHP] Newbie question, Which way is best?

2008-03-20 Thread Shawn McKenzie
George J wrote:
> ""Thiago Pojda"" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
>> De: George J [mailto:[EMAIL PROTECTED]
>>
>>> So calling the script via the form works i.e it passes the
>>> neccessary variables to constrct the sql query for the next
>>> call.
>> As Shawn said, if you really need the query again add it to session, 
>> never,
>> NEVER give the user the ability to see/execute queries by himself 
>> (remember
>> POST data could be easily manipulated). Remember what Daniel said, adding 
>> a
>> DELETE FROM is not hard and veeery bad>
> OK. I see the logic.
> 
>> Ok, let me ask you something. Why post to itself? You could have a script
>> only to do form actions, that way you can:
>> 1 Separate huge php validations with your html form.
>> 2 Use functions to handle the incoming data and writing the new query (or
>> the old one again).
> 
> I suspect that most folk in my position start the learning process by 
> finding a script that does a similar task and adapting it. This is basically 
> what I've done. I started by finding a form example and then added a 
> pagination routine then... Several deadends later... Not the best way to 
> write anything but the simplest of scripts. However, the numerous changes to 
> the code has entailed lots of learning during the process. So in answer to 
> your question. I didn't set out with any idea of the best way to write the 
> script. Just a broad idea of what I wanted to end up with.
> 
>> As it's built at server side, the user is never going to see your query or
>> [1]manipulate it as you're writing it all over again, just using your old
>> parameters (they could be added as hidden fields in the form if strictly
>> necessary).
>>
>>
>>> So, as I see it, the pagination links won't POST the form
>>> variables. How do I pass the 'SELECT * FROM mytable WHERE
>>> selection=option LIMIT start, range'
>>> query to the called script?
>> You should try building a default query where you only add the parameters
>> given by the user. If you can't seem to recover that, add them to 
>> $_SESSION
>> and you'll be fine next time you want them (if you don't overwrite it 
>> =] ).
>>
> My query code-
> 
> ---SQL query construction block
>   $query = "SELECT * FROM prods ";
>   if($catagory != 0){   // 
> if category != 0
>  $where="WHERE c = $catagory ";
>  if ($manu != 0){  // check 
> manu != 0
> $and = "AND m = $manu ";
> if ($searchstring != 0){
>$and = $and."AND description LIKE \"%$searchstring%\" "; // 
> check like != 0
> }
>  }else{
> ...
> $query=$query.$where.$and.$like
> 
> ---
> Can you please explain your suggestion above in laymans terms. I can't see 
> what you have in mind. Is it your suggestion to use one script, containing a 
> from, that calls another script that handles my query construction? That far 
> I follow you but what happens next?
> 
> 
> 
What file is this?  is the pagination code in this file also?  If not
where?  Post you pagination code and this is a simple explanation.

Build your query as you've done and stick it in a session var.  It is
now available to future calls to this page or other pages.

-Shawn

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



Re: [PHP] newbie question about one php script passing control to another

2008-03-20 Thread Daniel Brown
On Thu, Mar 20, 2008 at 12:37 PM, Rod Clay <[EMAIL PROTECTED]> wrote:
> Yes, let me try to say more about exactly what I'm trying to do.  I have
>  a php script running in a browser window (opened specifically for this
>  purpose) in which the user keys a blog item, then hits 'submit.'  After
>  this script has successfully added the new blog item to the database,
>  what I'd like to do is automatically close this window, and pass control
>  to the php script that displays the updated list of blog items (with of
>  course the newly added blog item) in the original browser window (the
>  window the user was looking at when s/he clicked on the 'Add a blog'
>  link).

That would be more of a JavaScript issue, really.  Have the user
click a link to refresh the parent and close the child.

On a different note, you probably got made fun of pretty often for
you name (especially last-name-first), eh?  My father's name was Dick
--- no joke.  Yeah he got hell all the time.  ;-P

-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



Re: [PHP] newbie question about one php script passing control to another

2008-03-20 Thread Rod Clay
Yes, let me try to say more about exactly what I'm trying to do.  I have 
a php script running in a browser window (opened specifically for this 
purpose) in which the user keys a blog item, then hits 'submit.'  After 
this script has successfully added the new blog item to the database, 
what I'd like to do is automatically close this window, and pass control 
to the php script that displays the updated list of blog items (with of 
course the newly added blog item) in the original browser window (the 
window the user was looking at when s/he clicked on the 'Add a blog' 
link). 


[EMAIL PROTECTED] wrote:

Im not sure I understand the question.

Pass control from index.php to welcome.php ???


index.php : "; ?>

welcome.php 

That kind of pass control?



Hello.  I am new to php programming, but have spent many years 
programming in many other languages, most recently perl (with which php 
seems to have much in common!).  In every other language I've worked 
with there is a way for one program to pass control to another.  
However, so far in all of the books and other documentation I've looked 
at for php, I cannot find a way for one php program to pass control to 
another.  Is this possible in php, and, if so, please let me know how.  
Thank you.


Rod Clay
[EMAIL PROTECTED]

  


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



RE: [PHP] newbie question about one php script passing control to another

2008-03-20 Thread admin
Im not sure I understand the question.

Pass control from index.php to welcome.php ???


index.php : "; ?>

welcome.php 

That kind of pass control?



Hello.  I am new to php programming, but have spent many years 
programming in many other languages, most recently perl (with which php 
seems to have much in common!).  In every other language I've worked 
with there is a way for one program to pass control to another.  
However, so far in all of the books and other documentation I've looked 
at for php, I cannot find a way for one php program to pass control to 
another.  Is this possible in php, and, if so, please let me know how.  
Thank you.

Rod Clay
[EMAIL PROTECTED]

-- 
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



Re: [PHP] Newbie question, Which way is best?

2008-03-20 Thread George J

""Thiago Pojda"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> De: George J [mailto:[EMAIL PROTECTED]
>
>> So calling the script via the form works i.e it passes the
>> neccessary variables to constrct the sql query for the next
>> call.
>
> As Shawn said, if you really need the query again add it to session, 
> never,
> NEVER give the user the ability to see/execute queries by himself 
> (remember
> POST data could be easily manipulated). Remember what Daniel said, adding 
> a
> DELETE FROM is not hard and veeery bad>
OK. I see the logic.

> Ok, let me ask you something. Why post to itself? You could have a script
> only to do form actions, that way you can:
> 1 Separate huge php validations with your html form.
> 2 Use functions to handle the incoming data and writing the new query (or
> the old one again).

I suspect that most folk in my position start the learning process by 
finding a script that does a similar task and adapting it. This is basically 
what I've done. I started by finding a form example and then added a 
pagination routine then... Several deadends later... Not the best way to 
write anything but the simplest of scripts. However, the numerous changes to 
the code has entailed lots of learning during the process. So in answer to 
your question. I didn't set out with any idea of the best way to write the 
script. Just a broad idea of what I wanted to end up with.

> As it's built at server side, the user is never going to see your query or
> [1]manipulate it as you're writing it all over again, just using your old
> parameters (they could be added as hidden fields in the form if strictly
> necessary).
>
>
>> So, as I see it, the pagination links won't POST the form
>> variables. How do I pass the 'SELECT * FROM mytable WHERE
>> selection=option LIMIT start, range'
>> query to the called script?
>
> You should try building a default query where you only add the parameters
> given by the user. If you can't seem to recover that, add them to 
> $_SESSION
> and you'll be fine next time you want them (if you don't overwrite it 
> =] ).
>
My query code-

---SQL query construction block
  $query = "SELECT * FROM prods ";
  if($catagory != 0){   // 
if category != 0
 $where="WHERE c = $catagory ";
 if ($manu != 0){  // check 
manu != 0
$and = "AND m = $manu ";
if ($searchstring != 0){
   $and = $and."AND description LIKE \"%$searchstring%\" "; // 
check like != 0
}
 }else{
...
$query=$query.$where.$and.$like

---
Can you please explain your suggestion above in laymans terms. I can't see 
what you have in mind. Is it your suggestion to use one script, containing a 
from, that calls another script that handles my query construction? That far 
I follow you but what happens next?




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



Re: [PHP] Newbie question, Which way is best?

2008-03-20 Thread Philip Thompson

On Mar 19, 2008, at 5:13 PM, George J wrote:

Hi Jason,

Hope this helps -
my 'display_products.php' script
--

...


...
// pagination routine
conditional code...
}else{
  echo("\"0\"

 ");

  }
---

So calling the script via the form works i.e it passes the neccessary
variables to constrct the sql query for the next call. If the user  
clicks
one of the pagination links, that calls itself, all that is passed  
is the
page=$i variable. I need to include the 'SELECT * FROM...' query  
either as a

string or an array of seperate values for the changed query.

So, as I see it, the pagination links won't POST the form variables.  
How do
I pass the 'SELECT * FROM mytable WHERE selection=option LIMIT  
start, range'

query
to the called script?

George


I don't know if anyone has answered the question you have asked at  
least twice... "How do I pass the query to the next page?" Here's how  
I would approach it. Don't pass the query - all you need is the page  
number. This code hasn't been tested, but I think you'll get the idea.


// Notice how you don't send the query in the POST or GET, just  
the page number
$sql = "SELECT `field` FROM `table` WHERE (`field_a` =  
'someValue') LIMIT $start, $length";

$results = mysql_query ($sql);
}

// Go to next page
$page = $_POST['page'] ? (int) $_POST['page'] + 1 : 1;
?>
...






...




Hopefully that helps a little bit.

~Philip

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



Re: Re: [PHP] Newbie question, Which way is best?]

2008-03-19 Thread George J
Hi Shawn,

"Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> George J wrote:
>> Hi Daniel,
>>
>>>WHOA!  Passing the SQL query via a URL is a Very Bad Idea[tm]!
>>
>> As a newbie I just have to ask why. I suspect you're going to say it 
>> gives
>> the table and field names used in my database. I'm not really aware of 
>> all
>> the possible avenues that this method might open up. It just feels wrong 
>> to
>> include these details. This is the reason I've asked for help.
>>
>> The form part of the script works fine so can we ignore that or does it
>> impact on the pagination code that I'm having trouble with.
>>
>> When the form calls the script it passes all the parameters that the 
>> script
>> uses to construct a SELECT query. This works fine.
>>
>> When the pagination calls the script it passes a new page number. This 
>> works
>> fine but is where my limited experience lets me down. I need to pass the
>> SELECT query, as is, back to the same script with a way to change just 
>> the
>> LIMIT part of the query. Changing the LIMIT parameters simple lets me
>> display another page of the returned query. I can do this change prior to
>> call but what options have I on including the query in my call. Could I
>> camouflage the query parameters in an array for example?
>>
>> George
>>

>
> Maybe add your query as a session var.  Depends upon how your app works.
> Is the pagination a series of links with get vars?
>
> // your script that receives post data
> session_start();
>
> if(!empty($_POST)) {
> $query = "Build query from post vars";
> $_SESSION['query'] = $query;
> } else {
> $query = $_SESSION['query'];
> }
> //  use your query
>
> Then there's the pagination stuff, but we'd need to see how you do it.
>
> -Shawn

My code checks the POSTed values
---
 if (isset($_REQUEST['selected_manu'])){
 $find_manu=$_POST['selected_manu'];
---

Yes, my pagination routine uses a series of links.

I'll underlline that I'm not only learning php but also HTML. I'm trying to 
keep things simple as there is so much to learn. I'm starting from scratch 
and find the coding fairly straightforward. However, selecting the 
appropriate techniques is another matter.

George 



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



[Fwd: Re: [PHP] Newbie question, Which way is best?]

2008-03-19 Thread Shawn McKenzie
George J wrote:
> Hi Daniel,
> 
>>WHOA!  Passing the SQL query via a URL is a Very Bad Idea[tm]!
> 
> As a newbie I just have to ask why. I suspect you're going to say it gives 
> the table and field names used in my database. I'm not really aware of all 
> the possible avenues that this method might open up. It just feels wrong to 
> include these details. This is the reason I've asked for help.
> 
> The form part of the script works fine so can we ignore that or does it 
> impact on the pagination code that I'm having trouble with.
> 
> When the form calls the script it passes all the parameters that the script 
> uses to construct a SELECT query. This works fine.
> 
> When the pagination calls the script it passes a new page number. This works 
> fine but is where my limited experience lets me down. I need to pass the 
> SELECT query, as is, back to the same script with a way to change just the 
> LIMIT part of the query. Changing the LIMIT parameters simple lets me 
> display another page of the returned query. I can do this change prior to 
> call but what options have I on including the query in my call. Could I 
> camouflage the query parameters in an array for example?
> 
> George
> 
> 
> 
> 
> 
> 
> 

Maybe add your query as a session var.  Depends upon how your app works.
 Is the pagination a series of links with get vars?

// your script that receives post data
session_start();

if(!empty($_POST)) {
$query = "Build query from post vars";
$_SESSION['query'] = $query;
} else {
$query = $_SESSION['query'];
}
//  use your query

Then there's the pagination stuff, but we'd need to see how you do it.

-Shawn






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



Re: [PHP] Newbie question, Which way is best?

2008-03-19 Thread Jason Pruim


On Mar 19, 2008, at 4:45 PM, George J wrote:


Hi Daniel,


  WHOA!  Passing the SQL query via a URL is a Very Bad Idea[tm]!


As a newbie I just have to ask why. I suspect you're going to say it  
gives
the table and field names used in my database. I'm not really aware  
of all
the possible avenues that this method might open up. It just feels  
wrong to

include these details. This is the reason I've asked for help.

The form part of the script works fine so can we ignore that or does  
it

impact on the pagination code that I'm having trouble with.

When the form calls the script it passes all the parameters that the  
script

uses to construct a SELECT query. This works fine.

When the pagination calls the script it passes a new page number.  
This works
fine but is where my limited experience lets me down. I need to pass  
the
SELECT query, as is, back to the same script with a way to change  
just the

LIMIT part of the query. Changing the LIMIT parameters simple lets me
display another page of the returned query. I can do this change  
prior to
call but what options have I on including the query in my call.  
Could I

camouflage the query parameters in an array for example?



Hi George,

As a relative newbie my self I think I understand what you are trying  
to do.


The reason Dan asked for the code though is because when you show the  
code we can easily point out what/where the issue is. If potental  
attackers have access to your field names they can much easier try and  
insert stuff into your database.


What I would probably do though is something along the lines of this:

//Always escape your data to make it a little harder on the hackers
$par1 = mysql_real_escape($_POST['parameter1']);
$par2 = mysql_real_escape($_POST['parameter2']);

$sql = "SELECT * from tablename where parameter1=".$par1." AND  
parameter2=".$par2"": etc etc etc...


There is more to this, but this should get you started.

that way you can run the script calling the variables which were  
POSTed instead of GETed so they won't be passed in the URL. It also  
has the benefit of not revealing your field names.


Now all of that was typed from memory so please do check to make sure  
it makes sense why it's working.


JP

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



Re: [PHP] Newbie question, Which way is best?

2008-03-19 Thread Daniel Brown
On Wed, Mar 19, 2008 at 4:45 PM, George J <[EMAIL PROTECTED]> wrote:
> Hi Daniel,
>
>
>  >WHOA!  Passing the SQL query via a URL is a Very Bad Idea[tm]!
>
>  As a newbie I just have to ask why. I suspect you're going to say it gives
>  the table and field names used in my database. I'm not really aware of all
>  the possible avenues that this method might open up. It just feels wrong to
>  include these details. This is the reason I've asked for help.

That's exactly what you should be doing, George.  That's how you learn!  ;-)

Not only are you giving away the schema of your database, but it
makes it that much easier to do VERY nasty things.  For example, say
you access the file like so:


http://www.domain.com/path/script.php?query=SELECT%20*%20FROM%20table%20WHERE%20result='this'%20LIMIT%2020,%2030

I could change it to something like this:


http://www.domain.com/path/script.php?query=SELECT%20*%20FROM%20table%20WHERE%20result='this'%20LIMIT%2020,%2030;DELETE%20FROM%20TABLE%20WHERE%201

And your database table is gone.

>  The form part of the script works fine so can we ignore that or does it
>  impact on the pagination code that I'm having trouble with.

As long as you sanitize anything sent to the database, I'm sure
it's fine.  Check out mysql_real_escape_string() for more on that:
http://php.net/mysql-real-escape-string

NOTE: If you're using mysqli, you don't need to add
mysql_real_escape_string() because it's already handled automatically.

-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



Re: [PHP] Newbie question, Which way is best?

2008-03-19 Thread George J
Hi Daniel,

>WHOA!  Passing the SQL query via a URL is a Very Bad Idea[tm]!

As a newbie I just have to ask why. I suspect you're going to say it gives 
the table and field names used in my database. I'm not really aware of all 
the possible avenues that this method might open up. It just feels wrong to 
include these details. This is the reason I've asked for help.

The form part of the script works fine so can we ignore that or does it 
impact on the pagination code that I'm having trouble with.

When the form calls the script it passes all the parameters that the script 
uses to construct a SELECT query. This works fine.

When the pagination calls the script it passes a new page number. This works 
fine but is where my limited experience lets me down. I need to pass the 
SELECT query, as is, back to the same script with a way to change just the 
LIMIT part of the query. Changing the LIMIT parameters simple lets me 
display another page of the returned query. I can do this change prior to 
call but what options have I on including the query in my call. Could I 
camouflage the query parameters in an array for example?

George








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



Re: [PHP] Newbie question, Which way is best?

2008-03-19 Thread Andrew Ballard
On Wed, Mar 19, 2008 at 3:47 PM, George J <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I have a script that contains a form and a pagination routine that calls
>  itself. I want to pass an sql query along with some other variables to the
>  called script. The code to acheive this, using the form, is working but when
>  I try to write the code, using the scripts URL to call itself, I am having
>  problems successfully passing the SQL query string within the url.
>
>  The form is used to construct a string containing a sql query. Whereas when
>  the pagination calls the script all it does is changes the LIMIT part of the
>  sql query. I know it won't pass the original query unless I add it to the
>  URL address.
>
>  Is there a 'proper' way to write this code? Should I add the query to the
>  URL or is there a better way?
>
>  TIA
>  George

My personal preference is to add all of the query parameters as hidden
fields in your form and pass them along from page to page. I wouldn't
send the actual SQL query (or any part of it) as part of the URL.

Andrew

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



Re: [PHP] Newbie question, Which way is best?

2008-03-19 Thread Daniel Brown
On Wed, Mar 19, 2008 at 3:47 PM, George J <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I have a script that contains a form and a pagination routine that calls
>  itself. I want to pass an sql query along with some other variables to the
>  called script. The code to acheive this, using the form, is working but when
>  I try to write the code, using the scripts URL to call itself, I am having
>  problems successfully passing the SQL query string within the url.

WHOA!  Passing the SQL query via a URL is a Very Bad Idea[tm]!

Show some code so that we can all see more about what you're
trying to do.  Maybe I'm misunderstanding your question.

-- 

Forensic Services, Senior Unix Engineer
1+ (570-) 362-0283

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



  1   2   3   4   >