Solved

put a variable into a hidden field

Posted on 2011-03-06
2
327 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 110

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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

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…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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 a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

688 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