hi guys, i just want to ask how could i input an action to a link?? the best choice was to create a button which will do the act, however, im having difficulties with it. now my resort was to add the code to the link..meaning instead of the submit button to perform the action, the link will do it..how could i do that? thanks...^_^

Perform what kind of action? JS, PHP..?

<script language="javascript">
function doAction(){
alert("Hello World");
}
</script>
<a href="#" onclick="doAction()">Do action</a>

<?php
if ($_GET['act'] == "DoAction")
echo "Hello World";
?>
<a href="myPage.php?act=DoAction">Do action</a>

put an event to your anchor link
ex. lets put a javascript onclick event on your anchor tag

<html>
<head>
<script>
function do_your_thing(){
//put want you want to happen here, ex. an alert script
alert('End of the World!');
}
</script>
</head>
<body>
<a href='#' onclick='do_your_thing()'>click me</a>
</body>
</html>

okei sir, i almost got it, i have another problem, how could i pass the data coming from a javascript to the php?? ^^

then use form... upon submitting the form. all it's data will be send to the server which then PHP parses.

okei sir, i almost got it, i have another problem, how could i pass the data coming from a javascript to the php?? ^^

then make a javascript function.

<script>
function do_your_thing(val){
window.location='yourpage.php?x='.val;
}

<script>
function do_your_thing(val){
window.location='yourpage.php?x='.val;
}
</script>

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.