php - if selected value = 1 do this, if selected value = 2 do this -


To use a selection form element, to ask the user, who wants to use it.

My problem is really low:

1 form element:

   
  1. PHP document

      & lt; Choose php $ = $ _POST ['inputQuest']; // Select 1 if ($ select = '1') {$ ch = curl_init (); Curl_setopt ($ ch, CURLOPT_URL, 'POSTURLHERE'); Curl_setopt ($ CH, CURLOPT_POST, 1); Curl_setopt ($ CH, CURLOPT_POSTFIELDS, 'POSTFIELDSHERE'); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); Curl_setopt ($ CH, CURLOPT_COOKIEFILE, $ global ['cookie']); $ Response = curl_exec ($ ch); Curl_close ($ ch); Echo "work 1 successfully"; } // selection 2 if (choose $ = '2') {$ startValue = 0; $ End value = 10; ($ StartValue; $ startValue & lt; = $ endValue; $ startValue ++) {$ ch = curl_init (); Curl_setopt ($ ch, CURLOPT_URL, 'POSTURLHERE'); Curl_setopt ($ CH, CURLOPT_POST, 1); Curl_setopt ($ CH, CURLOPT_POSTFIELDS, 'POSTFIELDSHERE'); Curl_setopt ($ CH, CURLOPT_RETURNTRANSFER, 1); Curl_setopt ($ CH, CURLOPT_COOKIEFILE, $ global ['cookie']); $ Response = curl_exec ($ ch); Curl_close ($ ch); Echo "function 2 found". $ StartValue "Bar added."; }}? & Gt; My question is: How can I run the selected code only to the PHP code which was posted with the form element      If you can see the code, then the criteria Tried to use, but it still runs both code.  

    Use $ select == '1' and $ Select == '2' - This method is checking to see if the variable value matches


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -