super quick php question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mkx
    Confirmed User
    • Nov 2003
    • 4001

    #1

    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
    see you later, I'm gone
    • Oct 2002
    • 14296

    #2
    if ($shipping_method='Postal')

    should be:

    if ($shipping_method=='Postal')

    = is an assignment

    == is a comparison

    .
    Last edited by sarettah; 10-21-2013, 07:51 PM.
    All cookies cleared!

    Comment

    • mkx
      Confirmed User
      • Nov 2003
      • 4001

      #3
      awesome, knew it was something simple, almost tried the == too thx so much

      Comment

      • fitzmulti
        I Like Depth Of Field!
        • Jan 2003
        • 14861

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


        www.SexyGirlsCash.com


        CONTACT // FITZMULTI AT GMAIL.COM //
        {Please include a message so I know you are from GFY! I get too many spam "add requests"!}

        Comment

        Working...