Solved

put a variable into a hidden field

Posted on 2011-03-06
2
323 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
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 109

Accepted Solution

by:
Ray Paseur earned 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
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 look for a specific file type in a local or remote server directory using PHP.

813 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now