captain_scarlet87 Posted April 21, 2010 Share Posted April 21, 2010 Hi, I just need help making the 'Edit' link in the following code a button. if(isset($_POST['topic'])){ // anything posted???? require_once ('../mysql_connect.php'); // Connect to the database. $dState = $_POST["topic"]; $sqlQuery = "SELECT title, instructions_id FROM uploaded_instructions WHERE topic=\"$dState\""; $result = mysql_query($sqlQuery); while ($row=mysql_fetch_array($result)){ echo ("<p><tr><td>• <a href=view_instructions.php?instructions_id=$row[instructions_id]> $row[title] </a></td>"); echo ("<td> | <a href=edit_form_instructions.php?id=$row[instructions_id]> Edit <a/></td></tr></p>");} } // end anything posted??? I've tried: echo ("<td><form action="edit_form_instructions.php?id=$row[instructions_id"><input type="Submit" value="Edit"></form></td></tr></p>");} but this error appears: Parse error: syntax error, unexpected T_STRING in C:\wamp\www\html\filter(admin).php on line 47 Help me please! Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/199308-using-a-button-instead-of-a-href/ Share on other sites More sharing options...
DJTim666 Posted April 21, 2010 Share Posted April 21, 2010 <td><input type='button' onClick=\"window.location='edit_form_instructions.php?id={$row['instructions_id']}';\" value='Submit' /></td></tr></p> Quote Link to comment https://forums.phpfreaks.com/topic/199308-using-a-button-instead-of-a-href/#findComment-1046075 Share on other sites More sharing options...
DavidAM Posted April 21, 2010 Share Posted April 21, 2010 That solution (by DJTim666) requires that your users have JavaScript enabled and will not do anything if it is not. Your original solution that produced an error should work if you fix the quotes. Your entire ECHO string is inside double quotes, so you can't have double quotes inside it unless you escape them. Change them to single quotes INSIDE the string and it should work. Quote Link to comment https://forums.phpfreaks.com/topic/199308-using-a-button-instead-of-a-href/#findComment-1046161 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.