0

I have succeeded displaying data from query from mysql. But there is a url that connected to files that has been stored in mysql database. But I need to changes this url that text based to a button. Here is my script:

<td align="center"><a href='<?php echo $res['url_new_edition'] ?>'>New Edition</a></td> 

Now I want to changes the 'New Edition' texts of course as a link/url into a button. I was already tried to add 'class=button', type='button' ect but none of works.

2 Answers 2

1

try this

<input type="button" onclick="window.location.href='http://google.com'; return false;">

in your case

<input type="button" onclick="window.location.href='<?php echo $res['url_new_edition'] ?>'; return false;">
Sign up to request clarification or add additional context in comments.

Comments

0

Use a form instead of a href if you want a button. A clear solution that even comes along without JavaScript would look like this:

<form action="<?php echo $res['url_new_edition']; ?>" method="get">
    <input type="submit" value="New Edition" />
</form>

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.