GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   super quick php question (https://gfy.com/showthread.php?t=1124124)

mkx 10-21-2013 08:40 PM

super quick php question
 
Code:

        preg_match('/(USPS|UPS)\s+?(Postal|Ground|Priority)\s/i',$page,$matched);
                                        if (isset($matched[1])) {
                                                $shipper = $matched[1];
                                        }
                                        if (isset($matched[2])) {
                                                $shipping_method = $matched[2];
                                        }

I want $shipping_method to be redeclared as 'USPS Priority' if it is previously declared as 'Postal' I made the below if statement to redeclare it but it is basically declaring it no matter what, even if it was original declared 'Ground'. I know I am missing something really simple. Any help? Programmer is offline and wanted to get this done tonight.



I added

Code:

                if ($shipping_method='Postal')
                                        {
                                                $shipping_method='Priority Mail';
                                        }


sarettah 10-21-2013 08:50 PM

if ($shipping_method='Postal')

should be:

if ($shipping_method=='Postal')

= is an assignment

== is a comparison

.

mkx 10-21-2013 08:54 PM

awesome, knew it was something simple, almost tried the == too :) thx so much

fitzmulti 10-21-2013 08:55 PM

Neat. Actual help w/o BS in a thread!
Nice, sarettah ;-)


All times are GMT -7. The time now is 03:24 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123