1

How do I turn the below code into a button on my page? It works the way its written but I don't like that it's a hyperlink. I would prefer it to be a button.

echo " <form>
<a href='test.php?id=$key&do=unfollow'>unfollow</a>
</form>";
2
  • Are you familiar with how buttons interact with PHP? Commented Jul 2, 2012 at 18:29
  • do u want this action in javascript? is it ok for u? Commented Jul 2, 2012 at 18:32

2 Answers 2

1

Try:

echo " <form action='test.php' method='GET'>
<input type='hidden' name='id' value='$key'/>
<input type='submit' name='do' value='unfollow'/>
</form>";
Sign up to request clarification or add additional context in comments.

1 Comment

This approach worked for me. Thanks mgraph. Exactly what I was looking for.
0

First: Your link does not have to be inside a FORM. This is because you don't have user input, and because you are using GET.

Second: Use CSS to style the hyperlink and make it look like a button.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.