By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,748 Members | 1,506 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,748 IT Pros & Developers. It's quick & easy.

Retrieve POSTed .NET control values in .PHP page

P: 6
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.
Jan 18 '07 #1
Share this Question
Share on Google+
7 Replies


ronverdonk
Expert 2.5K+
P: 4,258
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:
Jan 18 '07 #2

P: 6
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:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include '../includes/pdf/class.ezpdf.php';
  3.  
  4. $c_fullName=(empty($_POST['hidFullName'])) ? "" : stripslashes($_POST[hidFullName]);
  5. $c_ownPerct=(empty($_POST['hidOwner_T'])) ? "" : $_POST[hidOwner_T];
  6. $c_SSN=(empty($_POST['hidSSN_T'])) ? "" : $_POST[hidSSN_T];
  7. $c_address=(empty($_POST['hidAddress'])) ? "" : stripslashes($_POST[hidAddress]);
  8. $c_city=(empty($_POST['hidCity'])) ? "" : stripslashes($_POST[hidCity]);
  9. $c_state=(empty($_POST['hidState'])) ? "" : $_POST[hidState];
  10. //$c_county=(empty($_POST['county'])) ? "" : stripslashes($_POST[county]);
  11. $c_county="Dallas";
  12. $c_zipCode=(empty($_POST['hidZipCode'])) ? "" : $_POST[hidZipCode];
  13. $c_homePhone=(empty($_POST['hidPhone'])) ? "" : $_POST[hidPhone];
  14. $c_altPhone=(empty($_POST['hidAltPhone'])) ? "" : $_POST[hidAltPhone];
  15. //$c_phoneExt=(empty($_POST['phoneExt'])) ? "" : $_POST[phoneExt];
  16. $c_phoneExt="";
  17. //$c_faxPhone=(empty($_POST['hidPhoneWork_C'])) ? "" : $_POST[hidPhoneWork_C];
  18. $c_faxPhone="";
  19. $c_email=(empty($_POST['hidEmail'])) ? "" : $_POST[hidEmail];
  20. $c_ptrFullName=(empty($_POST['hidPartner'])) ? "" : stripslashes($_POST[hidPartner]);
  21. $c_ptrOwnPerct=(empty($_POST['hidOwner_2'])) ? "" : $_POST[hidOwner_2];
  22. $c_ptrSSN=(empty($_POST['hidSSN_S'])) ? "" : $_POST[hidSSN_S];
  23. $c_ptrAddress=(empty($_POST['hidPartnerAddress'])) ? "" : stripslashes($_POST[hidPartnerAddress]);
  24. $c_rbSpouse=(empty($_POST['hidSpouse'])) ? "0" : $_POST[hidSpouse];
  25. $c_comments="";
  26. $c_entityName=(empty($_POST['hidPartnershipName'])) ? "" : stripslashes($_POST[hidPartnershipName]);
  27. $c_entityStartDate=(empty($_POST['hidFormation'])) ? "" : date("m/d/Y",strtotime($_POST[hidFormation]));
  28. $c_chkEquities=(empty($_POST['hidEquities'])) ? 0 : 1;
  29. $c_chkOptions=(empty($_POST['hidOptions'])) ? 0 : 1;
  30. $c_chkCurrencies=(empty($_POST['hidCurrencies'])) ? 0 : 1;
  31. $c_chkCommodities=(empty($_POST['hidCommodities'])) ? 0 : 1;
  32. $c_rbDisposition=(empty($_POST['hidDisposition'])) ? "0" : $_POST[hidDisposition];
  33. $c_EIN="";
  34. $c_completed=0;
  35.  
This code works perfectly when the values are being passed from a .PHP page to this page.
Jan 18 '07 #3

ronverdonk
Expert 2.5K+
P: 4,258
And where is the code containing the <FORM> ?

Ronald :cool:
Jan 18 '07 #4

P: 6
And where is the code containing the <FORM> ?

Ronald :cool:
Expand|Select|Wrap|Line Numbers
  1.     <form id="frmDefault" runat="server" method="post">
  2. ... other stuff
  3.     </form>
  4.  
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.
Jan 18 '07 #5

ronverdonk
Expert 2.5K+
P: 4,258
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:
Expand|Select|Wrap|Line Numbers
  1. <form method="post" action="check.php">
  2. <input type="text" name="abc" value="XYZ" />
  3. <input type="submit" name='submit' value="Send it" />
  4. </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:
Expand|Select|Wrap|Line Numbers
  1. 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:
Jan 18 '07 #6

P: 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:
Expand|Select|Wrap|Line Numbers
  1. <form method="post" action="check.php">
  2. <input type="text" name="abc" value="XYZ" />
  3. <input type="submit" name='submit' value="Send it" />
  4. </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:
Expand|Select|Wrap|Line Numbers
  1. 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.
Jan 18 '07 #7

ronverdonk
Expert 2.5K+
P: 4,258
Glad I could have helped you out!

Ronald :cool:
Jan 18 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.