Retrieve POSTed .NET control values in .PHP page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mahill
    New Member
    • Jan 2007
    • 6

    Retrieve POSTed .NET control values in .PHP page

    I have values in a .ASPX page that I would like to pass and retrieve in a .PHP page. I am using $_POST[controlname], but it is not retrieving any of the values. What am I doing wrong?

    BTW - The values I want to retrieve from the .ASPX are .NET controls. I have even written the values into conventional hidden controls (input type="hidden") but still no values are being retrieved in the .PHP page. All values are contained within a <form method=post> in the .ASPX file.
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    At least show the code involved in this. Or do we have to guess?

    When posting code, enclose it within code or php tags!! See the Posting Guidelines at the top of this forum before you continue.

    Ronald :cool:

    Comment

    • Mahill
      New Member
      • Jan 2007
      • 6

      #3
      Originally posted by ronverdonk
      At least show the code involved in this. Or do we have to guess?

      When posting code, enclose it within code or php tags!! See the Posting Guidelines at the top of this forum before you continue.

      Ronald :cool:
      Code:
      <?php
      include '../includes/pdf/class.ezpdf.php';
      
      $c_fullName=(empty($_POST['hidFullName'])) ? "" : stripslashes($_POST[hidFullName]);
      $c_ownPerct=(empty($_POST['hidOwner_T'])) ? "" : $_POST[hidOwner_T];
      $c_SSN=(empty($_POST['hidSSN_T'])) ? "" : $_POST[hidSSN_T];
      $c_address=(empty($_POST['hidAddress'])) ? "" : stripslashes($_POST[hidAddress]);
      $c_city=(empty($_POST['hidCity'])) ? "" : stripslashes($_POST[hidCity]);
      $c_state=(empty($_POST['hidState'])) ? "" : $_POST[hidState];
      //$c_county=(empty($_POST['county'])) ? "" : stripslashes($_POST[county]);
      $c_county="Dallas";
      $c_zipCode=(empty($_POST['hidZipCode'])) ? "" : $_POST[hidZipCode];
      $c_homePhone=(empty($_POST['hidPhone'])) ? "" : $_POST[hidPhone];
      $c_altPhone=(empty($_POST['hidAltPhone'])) ? "" : $_POST[hidAltPhone];
      //$c_phoneExt=(empty($_POST['phoneExt'])) ? "" : $_POST[phoneExt];
      $c_phoneExt="";
      //$c_faxPhone=(empty($_POST['hidPhoneWork_C'])) ? "" : $_POST[hidPhoneWork_C];
      $c_faxPhone="";
      $c_email=(empty($_POST['hidEmail'])) ? "" : $_POST[hidEmail];
      $c_ptrFullName=(empty($_POST['hidPartner'])) ? "" : stripslashes($_POST[hidPartner]);
      $c_ptrOwnPerct=(empty($_POST['hidOwner_2'])) ? "" : $_POST[hidOwner_2];
      $c_ptrSSN=(empty($_POST['hidSSN_S'])) ? "" : $_POST[hidSSN_S];
      $c_ptrAddress=(empty($_POST['hidPartnerAddress'])) ? "" : stripslashes($_POST[hidPartnerAddress]);
      $c_rbSpouse=(empty($_POST['hidSpouse'])) ? "0" : $_POST[hidSpouse];
      $c_comments="";
      $c_entityName=(empty($_POST['hidPartnershipName'])) ? "" : stripslashes($_POST[hidPartnershipName]);
      $c_entityStartDate=(empty($_POST['hidFormation'])) ? "" : date("m/d/Y",strtotime($_POST[hidFormation]));
      $c_chkEquities=(empty($_POST['hidEquities'])) ? 0 : 1;
      $c_chkOptions=(empty($_POST['hidOptions'])) ? 0 : 1;
      $c_chkCurrencies=(empty($_POST['hidCurrencies'])) ? 0 : 1;
      $c_chkCommodities=(empty($_POST['hidCommodities'])) ? 0 : 1;
      $c_rbDisposition=(empty($_POST['hidDisposition'])) ? "0" : $_POST[hidDisposition];
      $c_EIN="";
      $c_completed=0;
      This code works perfectly when the values are being passed from a .PHP page to this page.

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        And where is the code containing the <FORM> ?

        Ronald :cool:

        Comment

        • Mahill
          New Member
          • Jan 2007
          • 6

          #5
          Originally posted by ronverdonk
          And where is the code containing the <FORM> ?

          Ronald :cool:
          Code:
              <form id="frmDefault" runat="server" method="post">
          ... other stuff
              </form>
          The form code is in a .master file that is used by the .aspx file. Do I need to post that as well?

          I guess generally I was asking if this was even a possibility. I really do not want to use querystrings, but if there is no other way, I have no choice.
          Last edited by Mahill; Jan 18 '07, 05:14 PM. Reason: Clarification

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            If you want to post data, you put it in a named <input> field in a form. Each form <input> field 's name and its content/value is, when that form is submitted, passed via the POST array to the script of which the name is specified in the action= attribute of the form definition. So:
            Code:
            <form method="post" action="check.php">
            <input type="text" name="abc" value="XYZ" />
            <input type="submit" name='submit' value="Send it" />
            </form>
            will send the form to the check.php script passing the 2 fields in the $_POST array. The $_POST array, when printed, looks then like:
            Code:
            array ( ['abc'] => 'XYZ'  ['submit'] => 'Send it' )
            In your PHP script, you handle the array as follows[php]<?php
            $var1 = $_POST['abc'];
            $var2 = $_POST['submit'];

            Now $var1 contains the value 'XYZ'and
            $var2 contains the value 'Send it'[/php]
            Ronald :cool:

            Comment

            • Mahill
              New Member
              • Jan 2007
              • 6

              #7
              Originally posted by ronverdonk
              If you want to post data, you put it in a named <input> field in a form. Each form <input> field 's name and its content/value is, when that form is submitted, passed via the POST array to the script of which the name is specified in the action= attribute of the form definition. So:
              Code:
              <form method="post" action="check.php">
              <input type="text" name="abc" value="XYZ" />
              <input type="submit" name='submit' value="Send it" />
              </form>
              will send the form to the check.php script passing the 2 fields in the $_POST array. The $_POST array, when printed, looks then like:
              Code:
              array ( ['abc'] => 'XYZ'  ['submit'] => 'Send it' )
              In your PHP script, you handle the array as follows[php]<?php
              $var1 = $_POST['abc'];
              $var2 = $_POST['submit'];

              Now $var1 contains the value 'XYZ'and
              $var2 contains the value 'Send it'[/php]
              Ronald :cool:
              I appreciate the response. Actually, my problem was simply that I was not submitting the .ASPX page, but merely hyperlinking to the .PHP so since nothing was submitted, no values were being read.

              Comment

              • ronverdonk
                Recognized Expert Specialist
                • Jul 2006
                • 4259

                #8
                Glad I could have helped you out!

                Ronald :cool:

                Comment

                Working...