Value from MySQL inserted into hidden form input.
Posted: Thu Aug 27, 2009 6:45 pm
Hello PHP Gurus,
Im struggleing to insert the value from the database into this hidden input. The query is at the top of the page which is select * from data and the column i need is title. I have tried 3 ways:
(line 59)
<input name="title" type="hidden" value="<? echo $row['title'] ;?>">
<input name="title" type="hidden" value="<? echo $_GET['title'] ;?>">
<input name="title" type="hidden" value="<? echo $_POST['title'] ;?>">
None work. As you will see in the attached code i haev got the title to appear once from the database so why cant it work again but this time be inside a hidden field.
Its been a whole day now and i think im about to lose my hair, any help is apreciated.
Im struggleing to insert the value from the database into this hidden input. The query is at the top of the page which is select * from data and the column i need is title. I have tried 3 ways:
(line 59)
<input name="title" type="hidden" value="<? echo $row['title'] ;?>">
<input name="title" type="hidden" value="<? echo $_GET['title'] ;?>">
<input name="title" type="hidden" value="<? echo $_POST['title'] ;?>">
None work. As you will see in the attached code i haev got the title to appear once from the database so why cant it work again but this time be inside a hidden field.
Its been a whole day now and i think im about to lose my hair, any help is apreciated.
Code: Select all
<?php
# connect to the database
mysql_connect('l222222');
mysql_select_db('22222');
session_start();
$my_id = trim (' ' . @$_GET['ID']) ;
if ('' < $my_id) { $my_id= (int) $my_id;
if ( 0 == $my_id) { $my_id= '';
} else $my_id = "$my_id";
}
if ('' == $my_id) {
} else {
$result = mysql_query("SELECT * FROM `data` WHERE job_id = '$my_id'") // This will return one result
or die(mysql_error());
}
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><h1>" . $row['title'] . "</h1></td>";
echo "<p>";
echo "</tr>";
}
?>
<form action="proofsend.php" method="post">
<p style="line-height: 150%">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Tahoma; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0">
<table border="0" cellpadding="7" cellspacing="1" width="460" id="AutoNumber55" bgcolor="#CFCFB3">
<tr>
<td bgcolor="#CCFFCC" valign="top">
If users accept a job but do not complete or submit fake proof to the employer <br/>
there account will be
<font color="#DD0000">
<span class="Apple-style-span" style="border-collapse: separate; font-family: Tahoma; font-size: 12px; font-style: normal; font-variant: normal; font-weight: 700; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0">
deleted</span></font><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Tahoma; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; ">.</span>
</td>
</tr>
</table>
<p style="line-height: 150%"><b>Have you finished this job?</b></p>
<p style="line-height: 150%">Enter the proof in the box below and
press submit.<br>
You must complete the job to the employers standards.</p>
<p style="line-height: 150%"><b>Enter proof<br>
<textarea rows="10" name="proof" cols="60">Write here</textarea></b></p>
<p>
<input name="title" type="hidden" value="<? echo $row['title'] ;?>"> <------ here ----------<
<input name="job_id" type="hidden" value="<? echo $my_id ;?>">
<input name="user_id" type="hidden" value="<? echo $_SESSION['user_id'] ;?>">
<input type="submit" value="Submit proof" name="submit"></p>
</form>
<?