Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.