How to creat the button for 'Export'? Thanks!

I want to combine below two sets of code

<?php  

echo"<a href='export.php?'>Export</a>

?>
<?php  

echo"<input type='button' value='Export'>";

?>

You'll have 2 options: (1) create a form so the button can submit to it's action or (2) you use the javascript onclick-event of the button to open export.php.

or css style the <a>nchor to look like a button

Or you can do something like this

<button><a href='export.php?'>Export</a></button>

After pressing the button, no respond!

Member Avatar for Zagga

Hi cliffcc

you need to add an 'onclick' event to make it work.

Try . . .

<button type="button" onclick="location='export.php'">Export</button>

Zagga

Or you can do something like this

<button><a href='export.php?'>Export</a></button>

I've used this method, but unless you include a type in your button tag it acts as a submit button. I recommend this small modification:

<button type='button'><a href='export.php'>Export</a></button>

edit: oops, didn't see Zagga's post. I've used the onclick solution and the href solution, both work.

Thanks all!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.