5 Replies - 1508 Views - Last Post: 19 June 2012 - 11:26 PM Rate Topic: -----

#1 huskyfritz   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 04-July 09

Cannot get the value of $_Post array

Posted 19 June 2012 - 06:04 PM

Hello guys,

I am new to php and i am having a simple problem by getting the value of the posted array. I have 2 simple file naming create.php and process.php. Create.php is use for user input and process.php will process the transaction. Here's my code to below:
create.php
 <form class="create-spss" method="POST" action="process.php">  
                    <div class="aw fl">
                        <table id="al">
    
                            <tr class="create-spss-tr">
                                <td><label for="cTransNo">Transaction #:</label></td>
                                <td><input type="text" name="cTransNo" id="name" disabled="disabled" value=<?php echo get_max_cTransNo(); ?> />  </td> 
                            </tr>   
                            
                            <tr class="create-spss-tr">
                                <td><label for="cBuCode">Company:</label></td>   
                                <td><input type="text" name="cBuCode" id="name" disabled="disabled" value=<?php echo $_SESSION['cBusinessUnit']; ?> />  </td> 
                            </tr>   
                            
                            <tr class="create-spss-tr">
                               <td>
                                 <input type="submit" name="submit" />
                               </td>
                            </tr>
   
                        </table>
                    </div>
                  
                    </form> 




and my process.php

if($_SERVER["REQUEST_METHOD"] == "POST")
	{
		$lcTransNo 		= $_POST['cBuCode'];
		$lcBuCode 		= $_POST['cBuCode'];
        }



when i click the submit button i am getting this error:
Notice: Undefined index: cTransNo in C:\wamp\www\Online Spss\create-spss_process.php on line 9
Notice: Undefined index: cBuCode in C:\wamp\www\Online Spss\create-spss_process.php on line 10


I've search the net for a while but it seems it works for them.

Please help me with this one guys.

Happy coding!

Thanks,
huskyfritz

Is This A Good Question/Topic? 0
  • +

Replies To: Cannot get the value of $_Post array

#2 no2pencil   User is online

  • Professor Snuggly Pants
  • member icon

Reputation: 6875
  • View blog
  • Posts: 31,665
  • Joined: 10-May 07

Re: Cannot get the value of $_Post array

Posted 19 June 2012 - 06:11 PM

Pretty sure you need the id of : cBuCode
<td><input type="text" name="cBuCode" id="cBuCode" disabled="disabled" value=<?php echo $_SESSION['cBusinessUnit']; ?> />  </td>


Was This Post Helpful? 0
  • +
  • -

#3 huskyfritz   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 04-July 09

Re: Cannot get the value of $_Post array

Posted 19 June 2012 - 06:14 PM

Thanks for the reply. Not the ID but the text. Do you know where I am going wrong with this one?

Thanks
Was This Post Helpful? 0
  • +
  • -

#4 codeprada   User is offline

  • Changed Man With Different Priorities
  • member icon

Reputation: 963
  • View blog
  • Posts: 2,382
  • Joined: 15-February 11

Re: Cannot get the value of $_Post array

Posted 19 June 2012 - 06:20 PM

Forms don't submit disabled elements. Use the readonly attribute instead.
Was This Post Helpful? 3
  • +
  • -

#5 huskyfritz   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 04-July 09

Re: Cannot get the value of $_Post array

Posted 19 June 2012 - 06:22 PM

Now I get it work by deleting
disabled="disabled" 


in the code
<td><input type="text" name="aha" id="name" disabled="disabled" value=<?php echo get_max_cTransNo(); ?> />  </td>



so my question is how do i need to disable that text input but still can get the values from it.

Thanks,
huskyfritz
Was This Post Helpful? 0
  • +
  • -

#6 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12769
  • View blog
  • Posts: 45,954
  • Joined: 27-December 08

Re: Cannot get the value of $_Post array

Posted 19 June 2012 - 11:25 PM

Use the readonly attribute, as codeprada suggested above.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1