RE: [PHP] Using link to submit a form
| From: | Matt Palermo | Date: | Wed, 30 Jul 2003 19:42:28 +0000 |
| Subject: | RE: [PHP] Using link to submit a form | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-157587@lists.php.net to get a copy of this message | ||
//Just use this javascript function...
echo "
<script LANGUAGE=\"JavaScript\">
<!--
function LetsSubmit(where)
{
document.forms[0].action = where;
document.forms[0].submit();
}
//-->
</script>
";
// Then output the submit link like this...
echo "
<a href=\"javascript:LetsSubmit('submit_page.php');\">
";
// You can have multiple submit links that send it
// to different pages just by changes the value
// inside the (''), like this...
echo "
<a href=\"javascript:LetsSubmit('another_page.php');\">
";
//You should be able to do as many different links
// with this function as you want. If you want a
// button like this, you can also do this...
echo "
<input type=\"submit\" value=\"Rename Files\" name=\"RenameButton\"
onclick=\"javascript:LetsSubmit('any_page.php');\">
";
I spent a while trying to figure this one out myself, so I hope this helps
you.
Matt
>===== Original Message From Tyler Longren <tyler@jdhost.com> =====
>Hi everyone,
>
>Can I replace "Submit" buttons on forms with a text button?
>I need to be able to click on a link:
><a href=index.php?option=edit>Edit</a>
>
>and have it submit the form. The form only contains one field...does anyone
>know how to do this? I've been searching google for an answer, but couldn't
>find any info that really applies to my question. This isn't exactly a PHP
>related question, but php is hugely involved in this project.
>
>Thanks!
>Tyler Longren
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php