我想将表单的值发布到两个数据库。 其中一个是本地的,一个不是。这就像客户端的“备份”。发布在两个php脚本上。
我现在的问题是我必须使用“POST”方法并将值传递给两个不同的脚本。我不知道我该怎么做。我的服务器不支持卷曲
这是我在用的:
<form action="" method="post" enctype="multipart/form-data" id="form">
<table cellspacing='0' onkeydown='return editingKeydown(event);'>
<tr><th>first_name<td class='function'>*<td><input value='' maxlength='100' size='40' id='first_name' name='first_name'>
<tr><th>last_name<td class='function'>*<td><input value='' maxlength='100' size='40' id='last_name' name='last_name'>
<tr><th>company<td class='function'>*<td><input value='' maxlength='100' size='40' id='company' name='company'>
<tr><th>phone<td class='function'>*<td><input value='' maxlength='100' size='40' id='phone' name='phone'>
<tr><th>email<td class='function'>*<td><input value='' maxlength='100' size='40' id='email' name='email'>
<tr><th>zip<td class='function'>*<td><input value='' maxlength='100' size='40' id='zip' name='zip'>
<tr><th>street<td class='function'>*<td><input value='' maxlength='100' size='40' id='street' name='street'>
<tr><th>city<td class='function'>*<td><input value='' maxlength='100' size='40' id='city' name='city'>
<tr><th>state<td class='function'>*<td><input value='' maxlength='100' size='40' id='state' name='state'>
<tr><th>country<td class='function'>*<td><input value='' maxlength='100' size='40' id='country' name='country'>
<tr><th>reasons<td class='function'>*<td><input value='' maxlength='300' size='40' id='reasons' name='reasons'>
<tr><th>notes<td class='function'>*<td><input value='' maxlength='300' size='40' name='notes' id='notes'>
<tr><th>callback<td class='function'>*<td><input value='' maxlength='100' size='40' id='callback' name='callback'>
</table>
<p>
<input type='submit' value='Salvează' onclick='javascript: return SubmitForm()'>
</form>
<script type='text/javascript'>
function SubmitForm()
{
if(document.forms['form'].onsubmit())
{
document.forms['form'].action='http://www.example.com/script1.php';
document.forms['form'].submit();
document.forms['form'].action='preproc.php';
document.forms['form'].submit();
}
return true;
}
</script>
这不是为我工作。你知道我能做到这一点吗?即使是替代品...
谢谢你的回答。
定期进行数据库的备份可以通过服务器应用程序可以轻松完成。是否有任何其他具体原因做到这一点。 – siddhesh
我会选择做数据库复制或定期转储(情况依赖)而不是这个。如果其中一个帖子失败,你会怎么做?将有一个不匹配。 – frz3993
客户需要我为此使用“后”方法。我也会去备份方法。 –