anser316 Posted April 18, 2008 Share Posted April 18, 2008 while($row = mysql_fetch_array( $result2 )) { echo "<tr><td>"; echo $row['presc_id']; echo "</a>"; echo "</td><td>"; echo $row['presc_date']; echo "</td><td>"; echo $row['exemption_type']; echo "</td><td>"; echo $row['branch_id']; echo "</td></tr>"; } echo "</table>"; echo"<form action=purchase.php method=post>"; echo "<p align=right>"; echo "<table border=1>"; echo "<tr>"; echo "<td>Search Drug Name </TD>"; echo "<td><input type=text name=drugname></TD>"; echo "<input type='hidden' name=presc_id value='$row['presc_id']'>"; //LINE 76 echo "</tr>"; echo "</table>"; echo "<input type =submit name='searchdrug' value= Search>"; echo "<input type = reset>"; echo "</form>"; }[code] I added line 76 to a working code, and got this error Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\project\branch1\SalesAssistant\purchase.php on line 76[/code] Link to comment https://forums.phpfreaks.com/topic/101695-input-hidden/ Share on other sites More sharing options...
Orio Posted April 18, 2008 Share Posted April 18, 2008 Try: echo "<input type='hidden' name=presc_id value='{$row['presc_id']}'>"; Orio. Link to comment https://forums.phpfreaks.com/topic/101695-input-hidden/#findComment-520261 Share on other sites More sharing options...
shreej21 Posted April 18, 2008 Share Posted April 18, 2008 you can replace this line 76 as echo "<input type='hidden' name=presc_id value='".$row['presc_id']."'>"; try it out Link to comment https://forums.phpfreaks.com/topic/101695-input-hidden/#findComment-520263 Share on other sites More sharing options...
anser316 Posted April 18, 2008 Author Share Posted April 18, 2008 thanks it works, but when i try this $dname = $_POST[drugname]; print $dname; $presc=$_POST[presc_id]; echo "presc:"; echo $presc; the dname works, but not the presc, and the presc is definetly getting a value, because where i showed before: echo $row['presc_id']; displayed a number Link to comment https://forums.phpfreaks.com/topic/101695-input-hidden/#findComment-520320 Share on other sites More sharing options...
haku Posted April 18, 2008 Share Posted April 18, 2008 That's because you are missing quotes on the name in your hidden input. Link to comment https://forums.phpfreaks.com/topic/101695-input-hidden/#findComment-520337 Share on other sites More sharing options...
anser316 Posted April 18, 2008 Author Share Posted April 18, 2008 i have put the quotes in as the posts before told me to do so Link to comment https://forums.phpfreaks.com/topic/101695-input-hidden/#findComment-520351 Share on other sites More sharing options...
haku Posted April 18, 2008 Share Posted April 18, 2008 ...and the other posters missed that. If they hadn't, you wouldn't still be having troubles, would you. In their defense, they weren't looking for that, they were looking for the answer to your original problem, which they found and gave you. This is a different issue. Link to comment https://forums.phpfreaks.com/topic/101695-input-hidden/#findComment-520361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.