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.
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.
Comment