Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

put a variable into a hidden field

Posted on 2011-03-06
2
Medium Priority
?
340 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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

604 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