473,830 Members | 2,205 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP: using input=hidden type data from form to get MySQL data

12 New Member
I am new to PHP but have been using it for about a week. I'm having no trouble using html forms to recall data from a MySQL table when the input type=text but i cant seem to find a way of recalling the data from the MySQL table when the input type=hidden.

Here's the form code:

[PHP]
<?php $action = $_REQUEST['action'];
$epic = $_REQUEST['epic']; ?>

<TR>
<TD>

<?php echo $action; ?>

<INPUT TYPE="HIDDEN" NAME="action" VALUE="

<?php
echo $action; ?>

"></TD>
<TD>

<?php
echo $epic; ?>

<INPUT TYPE="HIDDEN" NAME="epic" VALUE="

<?php
print $epic; ?>

" SIZE="4"></TD>
<TD><INPUT TYPE="TEXT" NAME="volume" SIZE="5"></TD>
<TD> </TD>
<TD> </TD>
</TR>
</TABLE>
<P><INPUT TYPE="SUBMIT" VALUE="Get Quote"</P>
</FORM>
[/PHP]

And the DB call:

<?php $getquote=@mysq l_query("SELECT EPIC,SharePrice FROM SharePrices WHERE EPIC = '$epic'");

The variable $epic is passed through first time in the URL from another page and is then displayed in the form as text but stored as hidden data as i dont want the user the ability to change it. The data comes back fine if I remove the where clause from the select or plug in a value eg. EPIC=ABC or set $epic=ABC before the query. The problem however is the data contained in $epic after it is passed through. i have used echo to display it and it looks ok. i have used various string function to remove spaces etc but all to no avail. The field EPIC is defined as CHAR(4) on the MySQL table and is the primary key.

Anybody got any help?

Cheers.
May 11 '07
11 11810
Motoma
3,237 Recognized Expert Specialist
pbmods for the win!

It works. Many Thanks pbmods.
May 13 '07 #11
Kailash12345
1 New Member
how can i send input hidden data one page to another page and then send to database? can somebody help me?
Mar 31 '17 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

5
4626
by: Phillip T. Murphy | last post by:
Well, after half pulling my hair out messing with this, I am thinking it is not possible. I did research and found references to "sub-queries" not possible in MySQL (I am using 4.0.18-32 with PHP 4). But, not sure if I am breaking that rule or not. Psuedo code of what I am trying to do... <?php $sql = "select * from table1";
7
5076
by: garbagecatcher | last post by:
Hello, here's my problem: On my web server I generate a file, I need to send this file to a different web server. I have no control over the other web server. The only way they accept files is through input type="file"
6
2065
by: Walter | last post by:
Hi, The user has to type his name into input a input field (type = text). This name must be passed to another ASP file. I did this but nothing happened: <form id=ins method="post" onsubmit="return doit()"> Type your name:<input id=txt1 type="text"> <INPUT id=smt TYPE="submit"> </form>
12
2174
by: Jim Tome | last post by:
Hi, I am trying to change and pass the value of a hidden input type on a form tag to a cgi processing script based on the value of a checkbox within the form: function CheckBoxes () { if (document.MyForm.CheckBox1.checked) { document.MyForm.recipient.value = "2"; document.MyForm.submit();
0
19297
by: IamtheEvster | last post by:
Hi All, I am currently using PHP 5 and MySQL 5, both on Fedora Core 5. I am unable to call a MySQL stored procedure that returns output parameters using mysql, mysqli, or PDO. I'm having a hell of a time with it... The following comes from phpinfo(): PHP Version: 5.1.2 mysql Client API version: 5.0.18 mysqli Client API version: 5.0.18
1
7734
by: zwieback89 | last post by:
Hi, I have a org tree with hierarchical display of employees built using classic asp and vbscript. I also have list of radio buttons for report names. I have 1 select box with dates in it. Then I click on the submit button to view the reports in Crystal. But
3
1700
by: brock797 | last post by:
hey im just starting to learn php and mysql, i am using CentOS 5 and have all the neccisary programs compiled correctly (apache, php, mysql, etc) i can use mysql from the command line with no flaws, however when i try to connect to mysql from php i get nothing, no errors no text at all just a blank page...i have a mysql_connect.php file and the php file i have created to access and change database variables, theres supposed to be an input box...
2
1923
by: adamace5o | last post by:
hi, i am trying to use a hidden form as a method of storing varibles for use throughout an online quiz site. I am using mysql to hold data about the users ie user id username and user password etc. The information is input into a visible form and then when the user clicks the submit button, a validatelogin.php script is run which takes the data from the input and checks it against the mysql database. I want to know if there is a way of...
7
4454
by: Jack Gray | last post by:
I have a form requiring data input for all fields. When any field is left blank and the data is submitted, the cgi file generates a new form which is populated with data already input and an error message to fill in the missing data. An anomaly occurs with the reprinted form. One field often requires input of more than one word from the original form. However, the reprinted form populates the text field with only the first word of the string....
0
10774
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10489
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10525
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10202
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9314
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7746
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6950
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.