?
Solved

put a variable into a hidden field

Posted on 2011-03-06
2
Medium Priority
?
335 Views
Last Modified: 2012-08-13
I have created a sum and my result is $result

I tried putting $result into the hidden field but it wouldn't insert into my database. For example, a value of <?php echo $_POST['rqty']; ?> worked. What would i have to change $result to in order to get it to insert into my database?
0
Comment
Question by:jonofat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Expert Comment

by:florjan
ID: 35046605
Do you get result inside of a function? if so try putting global $result; in function.
function some_function() {
global $result;

Open in new window

0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 35046628
tried putting $result into the hidden field

Do you mean into a type=hidden input control of HTML forms?  If you can show us the code you are using we can surely help you with this.  To echo a string into the HTML you can do something like this:

<form>
<input type="hidden" value="<?php echo $result; ?>" />
</form>

Not sure about the data base part until we see the code you are using to create the query.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
This article discusses how to create an extensible mechanism for linked drop downs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question