You are here: Re: Submit form with variable for action? « PHP Programming Language « IT news, forums, messages
Re: Submit form with variable for action?

Posted by rossz on 09/26/05 06:59

tencip wrote:
> Hi everyone,
>
> So, i've got a form that is very simple. It hold three elements:
> username, password, and domain. The goal here is to have the form
> submit the login to an administrative section depending on which domain
> someone has chosen.

Ok, this is an ugly hack that uses javascript. I would never use it
because there is no guarantee javascript is enabled.

<html>
<body>
<? if (!is_null($_POST['domain'])) { ?>
<form name='second' method='POST' action='<? $_POST['domain'];
?>/test/test2.php'>
<input type='hidden' name='name' value='<? print $_POST['name']; ?>'>
<input type='hidden' name='password' value='<? print
$_POST['password']; ?>'>
<input type='submit'>
</form>
<script language="javascript">document.forms[0].submit()</script>
<? } else { ?>
<form method='POST'>
domain: <input type='text' name='domain'><br>
Name: <input type='text' name='name'><br>
Password: <input type='text' name='password'><br>
<input type='submit'>
</form>
<? } ?>
</body>
</html>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация