Jump to content

Using a button instead of a href


captain_scarlet87

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/199308-using-a-button-instead-of-a-href/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.