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 shiplu@gmail.com 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-21 Thread shiplu
On Apr 22, 2013 7:00 AM, Bastien Koert phps...@gmail.com 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-20 Thread tamouse mailing lists
This will be brief as I'm on a tablet...

On Apr 19, 2013 5:53 PM, dealTek deal...@gmail.com 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-20 Thread Matijn Woudt
On Sat, Apr 20, 2013 at 12:51 AM, dealTek deal...@gmail.com 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 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


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

2013-04-19 Thread 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...

?php
$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 ' /br ';
}

?

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
?xml version=1.0 encoding=UTF-8?
response
  result1/result
  result-textSUCCESS/result-text
  transaction-id1865264174/transaction-id
  result-code100/result-code
  authorization-code123456/authorization-code
  avs-resultN/avs-result
  cvv-resultN/cvv-result
  action-typesale/action-type
  amount12.00/amount
  ip-address::1/ip-address
  industryecommerce/industry
  processor-idccprocessora/processor-id
  currencyUSD/currency
  order-descriptionSmall Order/order-description
  merchant-defined-field-1Red/merchant-defined-field-1
  merchant-defined-field-2Medium/merchant-defined-field-2
  order-id1234/order-id
  tax-amount2.00/tax-amount
  shipping-amount0.00/shipping-amount
  billing
first-nameJohn/first-name
last-nameSmith/last-name
address11234 Main St./address1
cityBeverly Hills/city
stateCA/state
postal90210/postal
countryUS/country
phone555-555-/phone
emailt...@example.com/email
companyAcme, Inc./company
cc-number40**0002/cc-number
cc-exp0118/cc-exp
  /billing
  shipping
first-nameMary/first-name
last-nameSmith/last-name
address11234 Main St./address1
cityBeverly Hills/city
stateCA/state
postal90210/postal
countryUS/country
address2Unit #2/address2
  /shipping
  product
product-codeSKU-123456/product-code
descriptiontest product description/description
commodity-codeabc/commodity-code
unit-of-measure1/unit-of-measure
unit-cost5./unit-cost
quantity1./quantity
total-amount7.00/total-amount
tax-amount2.00/tax-amount
tax-rate1.00/tax-rate
discount-amount2.00/discount-amount
discount-rate1.00/discount-rate
tax-typesales/tax-type
alternate-tax-id12345/alternate-tax-id
  /product
  product
product-codeSKU-123456/product-code
descriptiontest 2 product description/description
commodity-codeabc/commodity-code
unit-of-measure2/unit-of-measure
unit-cost2.5000/unit-cost
quantity2./quantity
total-amount7.00/total-amount
tax-amount2.00/tax-amount
tax-rate1.00/tax-rate
discount-amount2.00/discount-amount
discount-rate1.00/discount-rate
tax-typesales/tax-type
alternate-tax-id12345/alternate-tax-id
  /product
/response








--
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 deal...@gmail.com:

 Hi all,

 newbie - just starting with trying to parse XML...


 $mylist = simplexml_load_file('thelist.xml');

 then use a foreach to echo the data...

 ?php
 $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 ' /br ';
 }

 ?

 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
 ?xml version=1.0 encoding=UTF-8?
 response
   result1/result
   result-textSUCCESS/result-text
   transaction-id1865264174/transaction-id
   result-code100/result-code
   authorization-code123456/authorization-code
   avs-resultN/avs-result
   cvv-resultN/cvv-result
   action-typesale/action-type
   amount12.00/amount
   ip-address::1/ip-address
   industryecommerce/industry
   processor-idccprocessora/processor-id
   currencyUSD/currency
   order-descriptionSmall Order/order-description
   merchant-defined-field-1Red/merchant-defined-field-1
   merchant-defined-field-2Medium/merchant-defined-field-2
   order-id1234/order-id
   tax-amount2.00/tax-amount
   shipping-amount0.00/shipping-amount
   billing
 first-nameJohn/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 phone555-555-/phone
 emailt...@example.com/email
 companyAcme, Inc./company
 cc-number40**0002/cc-number
 cc-exp0118/cc-exp
   /billing
   shipping
 first-nameMary/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 address2Unit #2/address2
   /shipping
   product
 product-codeSKU-123456/product-code
 descriptiontest product description/description
 commodity-codeabc/commodity-code
 unit-of-measure1/unit-of-measure
 unit-cost5./unit-cost
 quantity1./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
   product
 product-codeSKU-123456/product-code
 descriptiontest 2 product description/description
 commodity-codeabc/commodity-code
 unit-of-measure2/unit-of-measure
 unit-cost2.5000/unit-cost
 quantity2./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
 /response








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




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

2013-04-19 Thread dealTek

On Apr 19, 2013, at 1:33 PM, Sebastian Krebs krebs@gmail.com 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 deal...@gmail.com:
 Hi all,
 
 newbie - just starting with trying to parse XML...
 
 
 $mylist = simplexml_load_file('thelist.xml');
 
 then use a foreach to echo the data...
 
 ?php
 $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 ' /br ';
 }
 
 ?
 
 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
 ?xml version=1.0 encoding=UTF-8?
 response
   result1/result
   result-textSUCCESS/result-text
   transaction-id1865264174/transaction-id
   result-code100/result-code
   authorization-code123456/authorization-code
   avs-resultN/avs-result
   cvv-resultN/cvv-result
   action-typesale/action-type
   amount12.00/amount
   ip-address::1/ip-address
   industryecommerce/industry
   processor-idccprocessora/processor-id
   currencyUSD/currency
   order-descriptionSmall Order/order-description
   merchant-defined-field-1Red/merchant-defined-field-1
   merchant-defined-field-2Medium/merchant-defined-field-2
   order-id1234/order-id
   tax-amount2.00/tax-amount
   shipping-amount0.00/shipping-amount
   billing
 first-nameJohn/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 phone555-555-/phone
 emailt...@example.com/email
 companyAcme, Inc./company
 cc-number40**0002/cc-number
 cc-exp0118/cc-exp
   /billing
   shipping
 first-nameMary/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 address2Unit #2/address2
   /shipping
   product
 product-codeSKU-123456/product-code
 descriptiontest product description/description
 commodity-codeabc/commodity-code
 unit-of-measure1/unit-of-measure
 unit-cost5./unit-cost
 quantity1./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
   product
 product-codeSKU-123456/product-code
 descriptiontest 2 product description/description
 commodity-codeabc/commodity-code
 unit-of-measure2/unit-of-measure
 unit-cost2.5000/unit-cost
 quantity2./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
 /response
 
 
 
 
 
 
 
 
 --
 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 tamouse mailing lists
On Fri, Apr 19, 2013 at 4:04 PM, dealTek deal...@gmail.com wrote:

 On Apr 19, 2013, at 1:33 PM, Sebastian Krebs krebs@gmail.com 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 deal...@gmail.com:
 Hi all,

 newbie - just starting with trying to parse XML...


 $mylist = simplexml_load_file('thelist.xml');

 then use a foreach to echo the data...

 ?php
 $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 ' /br ';
 }

 ?

 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
 ?xml version=1.0 encoding=UTF-8?
 response
   result1/result
   result-textSUCCESS/result-text
   transaction-id1865264174/transaction-id
   result-code100/result-code
   authorization-code123456/authorization-code
   avs-resultN/avs-result
   cvv-resultN/cvv-result
   action-typesale/action-type
   amount12.00/amount
   ip-address::1/ip-address
   industryecommerce/industry
   processor-idccprocessora/processor-id
   currencyUSD/currency
   order-descriptionSmall Order/order-description
   merchant-defined-field-1Red/merchant-defined-field-1
   merchant-defined-field-2Medium/merchant-defined-field-2
   order-id1234/order-id
   tax-amount2.00/tax-amount
   shipping-amount0.00/shipping-amount
   billing
 first-nameJohn/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 phone555-555-/phone
 emailt...@example.com/email
 companyAcme, Inc./company
 cc-number40**0002/cc-number
 cc-exp0118/cc-exp
   /billing
   shipping
 first-nameMary/first-name
 last-nameSmith/last-name
 address11234 Main St./address1
 cityBeverly Hills/city
 stateCA/state
 postal90210/postal
 countryUS/country
 address2Unit #2/address2
   /shipping
   product
 product-codeSKU-123456/product-code
 descriptiontest product description/description
 commodity-codeabc/commodity-code
 unit-of-measure1/unit-of-measure
 unit-cost5./unit-cost
 quantity1./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
   product
 product-codeSKU-123456/product-code
 descriptiontest 2 product description/description
 commodity-codeabc/commodity-code
 unit-of-measure2/unit-of-measure
 unit-cost2.5000/unit-cost
 quantity2./quantity
 total-amount7.00/total-amount
 tax-amount2.00/tax-amount
 tax-rate1.00/tax-rate
 discount-amount2.00/discount-amount
 discount-rate1.00/discount-rate
 tax-typesales/tax-type
 alternate-tax-id12345/alternate-tax-id
   /product
 /response








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


---



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


all page code - with edits...

?php





// API Setup Parameters

$gatewayURL = '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 '  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;';

print '

html

  head

meta http-equiv=Content-Type content=text/html; charset=UTF-8 /

titleCollect non-sensitive Customer Info /title

  /head

  body

  ph2Step One: Collect non-sensitive payment information.br //h2/p



  h3 Customer Information/h3

  h4 Billing Details/h4



form action= method=post

  table

  trtdCompany/tdtdinput type=text 
name=billing-address-company value=Acme, Inc./td/tr

 
 
 --- more



  trtdh4br / Shipping Details/h4

  
  
  --more
  

  trtd colspan=2nbsp;/td

  trtd colspan=2 align=centerTotal Amount $12.00 /td/tr

  trtd colspan=2 align=centerinput type=submit value=Submit 
Step Oneinput type=hidden name =DO_STEP_1 value=true/td/tr

  /table



/form

  /body

/html



';

}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);


[PHP] Newbie question: replacing truetype fonts with UTF8 encoded Unicode characters

2011-08-22 Thread Venkatesh
Greetings

I have some HTML text using truetype fonts which i have to convert to UTF8
encoded unicode characters. I am just trying to replace the truetype font
characters.

The problem is that somehow the HTML tags also get converted to UTF8 :-(


I do a lot of str_replace such as the following:
$body = str_replace(þ, க்ஷ, $body);
$body = str_replace(þ£, க்ஷா, $body);
$body = str_replace(¬þ, க்ஷை, $body);
$body = str_replace(V, க்ஷி, $body);
$body = str_replace(r, க்ஷீ, $body);
$body = str_replace(þ§, க்ஷு, $body);
$body = str_replace(þ¨, க்ஷூ, $body);

I guess i am missing something as silly as encoding the characters into
certain type of  strings, do the conversion and then convert to back to UTF8

How best to do this? Sorry if this is a very basic question. Thanks a lot in
advance


Regards


Venkatesh


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 ?php ? 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. What is the best structure of a php-app?

2011-08-16 Thread Richard Quadling
On 16 August 2011 09:53, Dajka Tamás vi...@vipernet.hu 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 ?php ? 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 separate SQL Server instances (I'm on Windows and mainly
develop for MS SQL Server

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

2011-08-15 Thread Andreas

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



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-07 Thread tedd

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

On Thu, Jan 6, 2011 at 23:09, Bill Guion bgu...@comcast.net 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 David Hutto
On Fri, Jan 7, 2011 at 2:33 PM, tedd tedd.sperl...@gmail.com wrote:
 At 2:16 AM -0500 1/7/11, Daniel Brown wrote:

 On Thu, Jan 6, 2011 at 23:09, Bill Guion bgu...@comcast.net 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-06 Thread tedd

At 8:16 PM -0500 1/5/11, Daniel Brown wrote:
On Wed, Jan 5, 2011 at 19:45, David Harkness 
davi...@highgearmedia.com 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-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 
davi...@highgearmedia.com 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 Daniel Brown
On Thu, Jan 6, 2011 at 23:09, Bill Guion bgu...@comcast.net 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.

-- 
/Daniel P. Brown
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 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:

?php echo('Hello World'); ?

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-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 Daniel Brown
On Wed, Jan 5, 2011 at 11:32, David Harkness davi...@highgearmedia.com 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.

-- 
/Daniel P. Brown
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 Robert Cummings

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

On Wed, Jan 5, 2011 at 11:32, David Harknessdavi...@highgearmedia.com  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 David Harkness
On Wed, Jan 5, 2011 at 10:35 AM, Daniel Brown danbr...@php.net wrote:

 On Wed, Jan 5, 2011 at 11:32, David Harkness davi...@highgearmedia.com
 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 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 3:05 PM, tedd tedd.sperl...@gmail.com 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 Daniel Brown
On Wed, Jan 5, 2011 at 19:45, David Harkness davi...@highgearmedia.com 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

-- 
/Daniel P. Brown
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-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 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-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 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 immor...@nwconx.net 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 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 immor...@nwconx.net 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 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 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-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?

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=
http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type
content=text/html; charset=utf-8 / titleUntitled Document/title
/head body ?php $a = hello; $hello =Hello Everyone; echo $a; echo
$hello; ? /body /html
On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn josh.k...@gmail.com 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-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?
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=
 http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type
 content=text/html; charset=utf-8 / titleUntitled Document/title
 /head body ?php $a = hello; $hello =Hello Everyone; echo $a; echo
 $hello; ? /body /html
 On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn josh.k...@gmail.com 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 Joshua Kehn
On Jan 2, 2011, at 11:48 AM, 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
 

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 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?
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=
 http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type
 content=text/html; charset=utf-8 / titleUntitled Document/title
 /head body ?php $a = hello; $hello =Hello Everyone; echo $a; echo
 $hello; ? /body /html
 On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn josh.k...@gmail.com 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 12:50 PM, ad...@buskirkgraphics.com 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 ?php ? 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 Adam Richardson
On Sun, Jan 2, 2011 at 12:16 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 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 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 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 josh.k...@gmail.com 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 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 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 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



[PHP] Newbie Question

2011-01-01 Thread Adolfo Olivera
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,


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:

?php echo Hello World!; ?

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-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:
 
 ?php echo Hello World!; ?
 

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: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 Adolfo Olivera
Sorry, here is the code. The .php extension is a requirement? Can't it b
embedded on a .html file?

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=
http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type
content=text/html; charset=utf-8 / titleUntitled Document/title
/head body ?php $a = hello; $hello =Hello Everyone; echo $a; echo
$hello; ? /body /html
On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn josh.k...@gmail.com 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 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?
 
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; 
 html xmlns=http://www.w3.org/1999/xhtml;
 head
 meta http-equiv=Content-Type content=text/html; charset=utf-8 /
 titleUntitled Document/title
 
 /head
 body
 ?php
 $a = hello;
 $hello =Hello Everyone;
 echo $a;
 echo $hello;
 ?
 /body
 /html
 
 On Sat, Jan 1, 2011 at 9:55 PM, Joshua Kehn josh.k...@gmail.com 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



[PHP] newbie question about code

2010-09-10 Thread Adam Williams
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
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 adam_willi...@bellsouth.net
Date: Fri, Sep 10, 2010 19:27
Subject: [PHP] newbie question about code
To: PHP General list php-general@lists.php.net

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 josh.k...@gmail.com
Date: Fri, Sep 10, 2010 19:32
Subject: [PHP] newbie question about code
To: Bob McConnell r...@cbord.com
Cc: Adam Williams adam_willi...@bellsouth.net, PHP General list 
php-general@lists.php.net


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 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 josh.k...@gmail.com
 Date: Fri, Sep 10, 2010 19:32
 Subject: [PHP] newbie question about code
 To: Bob McConnell r...@cbord.com
 Cc: Adam Williams adam_willi...@bellsouth.net, PHP General list 
 php-general@lists.php.net
 
 
 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 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 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 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
adam_willi...@bellsouth.netwrote:

 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-

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 Adam Richardson
On Fri, Sep 10, 2010 at 3:03 PM, Joshua Kehn josh.k...@gmail.com 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 Conditionals

2010-03-31 Thread Richard Quadling
On 31 March 2010 05:45, Matty Sarro msa...@gmail.com wrote:
 That explains it perfectly, thanks you!

 On Wed, Mar 31, 2010 at 12:40 AM, Tommy Pham tommy...@gmail.com wrote:

 On Tue, Mar 30, 2010 at 9:22 PM, Matty Sarro msa...@gmail.com 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'] . 'br
  /';
  }
 
  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?

?php while($pos = strpos('abc', 'a')) { echo 'a';} ?

and

?php while($pos = strpos('abc', 'z')) { echo 'z';} ?

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

?php while(False !== ($pos = strpos('abc', 'a'))) { echo 'a';} ?

and

?php while(False !== ($pos = strpos('abc', 'z'))) { echo 'z';} ?

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=ZEND002498r=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-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
rquadl...@googlemail.comwrote:

 On 31 March 2010 05:45, Matty Sarro msa...@gmail.com wrote:
  That explains it perfectly, thanks you!
 
  On Wed, Mar 31, 2010 at 12:40 AM, Tommy Pham tommy...@gmail.com wrote:
 
  On Tue, Mar 30, 2010 at 9:22 PM, Matty Sarro msa...@gmail.com 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'] .
 'br
   /';
   }
  
   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?

 ?php while($pos = strpos('abc', 'a')) { echo 'a';} ?

 and

 ?php while($pos = strpos('abc', 'z')) { echo 'z';} ?

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

 ?php while(False !== ($pos = strpos('abc', 'a'))) { echo 'a';} ?

 and

 ?php while(False !== ($pos = strpos('abc', 'z'))) { echo 'z';} ?

 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=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling



[PHP] Newbie Question about Conditionals

2010-03-30 Thread Matty Sarro
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'] . 'br
/';
}

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


Re: [PHP] Newbie Question about Conditionals

2010-03-30 Thread Tommy Pham
On Tue, Mar 30, 2010 at 9:22 PM, Matty Sarro msa...@gmail.com 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'] . 'br
 /';
 }

 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 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 tommy...@gmail.com wrote:

 On Tue, Mar 30, 2010 at 9:22 PM, Matty Sarro msa...@gmail.com 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'] . 'br
  /';
  }
 
  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] newbie question - php parsing

2009-07-22 Thread Sebastiano Pomata
Hi all,

A little doubt caught me while I was writing this snippet of code for
a wordpress template:

?php if (the_title('','',FALSE) != 'Home') { ?
h2 class=entry-header?php the_title(); ?/h2
?php } ?

I always thought that php was called only between the ?php ? tags,
and I'm pretty sure that's right, while HTML code was simply wrote in
document as is, without further logic.
Now, I can't figure out how this snippet works: I mean, shouldn't HTML
code be simply put on document, as it is outside php invoke?
Effectively if the title of page is 'Home', the HTML part is totally
skipped.

Is the if construct that does all the magic inside?

-- 
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-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 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 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 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=5b=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 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:

 

?php

$uri_vars = explode('/', $_SERVER['PATH_INFO']); foreach ($uri_vars as
$var)

if ($var != )

echo $var . br;

?



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

2008-06-18 Thread Ethan Whitt
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?

Thanks in advance!

Ethan


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

?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(pMessage successfully sent!/p);
} else {
 echo(pMessage delivery failed.../p);
}

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


  ?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(pMessage successfully sent!/p);
  } else {
   echo(pMessage delivery failed.../p);

  }
[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):

?php

$where_form_is =
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);

?


-- 
/Daniel P. Brown
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):

?php

$where_form_is =
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: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.

-- 
/Daniel P. Brown
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:


?php

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

-- 
/Daniel P. Brown
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



[PHP] Newbie question about sending email

2008-04-16 Thread Pete Holsberg
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?


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

-- 
/Daniel P. Brown
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 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:

?php

$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);

?

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

  ?php


 $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):

input type=text name=from_addr

Then, change the email processing code to the following:

?php

$where_form_is =
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.

-- 
/Daniel P. Brown
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:

 ?php


$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):

input type=text name=from_addr

Then, change the email processing code to the following:

?php

$where_form_is =
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 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.

-- 
/Daniel P. Brown
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



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

2008-03-20 Thread Thiago Pojda
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.

 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.

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

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 =] ).

 George
Welcome and keep asking :)


[1] As long as you treat the user input properly, as other said.
 



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

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

Hi Jason,

Hope this helps -
my 'display_products.php' script
--
form method='post' action='display_products.php'
...
input type='hidden' name= 'query' value=$query
input type='submit' Value='Go'/td
...
// pagination routine
conditional code...
}else{
  echo(a href=\display_products.php?page=$i\img src=$st border= 
\0\

/a );

  }
---

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.


?php
// thispage.php
if (isset ($_POST['submitted'])) {
$resultsPerPage = 50; // or whatever value
$page = mysql_real_escape_string ($_POST['page']);

$start = ($page * $resultsPerPage) - $resultsPerPage;
$length = $start + $resultsPerPage;

// 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;
?
...
form method=post action=thispage.php
input type=submit value=Go /
input type=hidden name=page value=?php echo htmlentities  
($page); ? /

input type=hidden name=submitted value=1 /
/form
...

?php
while ($row = mysql_fetch_array ($results, MYSQL_ASSOC)) {
// Display results
}
?


Hopefully that helps a little bit.

~Philip

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



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

2008-03-20 Thread Rod Clay
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, 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 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 : ? echo form action=welcome.php method=postinput type=hidden 
name=tagme value=yesinput type=submit value='Continue'/form; ?

welcome.php ? if($_POST['tagme'] == yes){
echo Congrats you are there;}ELSE{echo You failed;}
?

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 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 : ? echo form action=welcome.php method=postinput type=hidden name=tagme 
value=yesinput type=submit value='Continue'/form; ?

welcome.php ? if($_POST['tagme'] == yes){
echo Congrats you are there;}ELSE{echo You failed;}
?

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

-- 
/Daniel P. Brown
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-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, 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(a href=\display_products.php?page=$pageprev\img 
src=\btnprevenabled.gif\ ALT=\Previous\ border=\0\ /a );
}else{
echo(img src=\btnprevdisnabled.gif\ ALT=\Previous\border=\0\ 
  );
}
//
$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(img src=$str3 border=\0\ );
}else{
 $str3=$str1.$str2._enabled.gif;
echo(a href=\displayproducts.php?page=$i\img src=$str3 
border=\0\ /a );
 }
}
// if last page is less than full
if(($totalrows % $show) != 0){
   $str2=$i;
  if($i == $page){
 $str3=$str1.$str2.disabled.gif;
  echo(img src=$str3 border=\0\ );//$i );
}else{
 $str3=$str1.$str2.enabled.gif;
  echo(a href=\displayproducts.php?page=$i\img src=$str3 
border=\0\ /a );//$i/a );
}
}
// Display the enabled or disabled 'Next' button
if(($totalrows - ($show * $page))  0){
  //$str3=$str1.$str2.disabled.gif;
$pagenext =$page+1;
echo(a href=\displayproducts.php?page=$pagenext\img 
src=\btnnextenabled.gif\ border=\0\ /a);//$i/a );
}else{
   $pagenext =$page+1;
echo(img src=\btnnextdisabled.gif\ ALT=\Next\border=\0\  
);
}
?
/td/font/tr/table
---

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



  1   2   3   4   5   6   >