打开PHP页面按钮单击

时间:2011-12-20 17:13:11

标签: php javascript

我想知道是否有人可以帮助我。

我将以下表格放在一个PHP文件中。

<form name="savemyfindstolocation" id="savemyfindstolocation" method="post">    
            <p><label></label>
            </p>
            <p align="left">
                <input name="userid" type="text" id="userid"/>
                <input name="locationid" type="text" id="locationid"/>
                <br />
            </p>
            <div>
                <label>
                    <div align="left">Click on the map to place the marker for the find that has been made and drag until the precise location has been found. </div>
          </div>
                    <p align="left"><label>Find OSGB36 Latitude Co-ordinate<br />
                        </label>
                    </p>
                    <div>
                        <div align="left">
                            <input name="findosgb36lat" type="text" id="findosgb36lat" size="20" />
                        </div>
                    </div>
                    <p align="left"><label>Find OSGB36 Longitude Co-ordinate<br />
                        </label>
                    </p>
                    <div>
                        <div align="left">
                            <input name="findosgb36lon" type="text" id="findosgb36lon" size="20" />
                        </div>
                    </div>
                    <p align="left"><label>Date of Trip<br />
                        </label>
                    </p>
                    <div>
                        <div align="left">
                            <input name="dateoftrip" type="text" id="dateoftrip" size="10" />
                        </div>
                    </div>
   <input name="submit" type="submit" onclick="MM_callJS('savedata()')" value="Submit" />        
    </form>

一切正常,但我现在想添加一个按钮,打开以下php页面'blobupload.php'。如果我从我所做的研究中正确理解了这一点,我需要使用javascript打开页面,使用主表单中的“提交”操作。

我不明白的是,当已经采取“提交”措施来保存主表单上的信息时,该怎么做。

也许有人可以告诉我如何解决这个问题,即使用相同的“提交行动,但出于两个不同的目的。”

3 个答案:

答案 0 :(得分:0)

只需修改表单标记(将action属性添加到要加载的文件中):

<form name="savemyfindstolocation" id="savemyfindstolocation" method="post" action="blobupload.php">

并提交输入标记:

<input name="submit" type="submit" value="Submit" />

答案 1 :(得分:0)

您可以使用第二个javascript函数以这种方式打开新窗口

   <input name="submit" type="submit" onclick="MM_callJS('savedata()');SECOND_JS_FUNCTION()" value="Submit" />

答案 2 :(得分:0)

使用php来处理表单是其中一种方法。

<input name="submit" !!!!!!action="process.php" method="POST (or get)!!!!!!!!!! type="submit"     onclick="MM_callJS('savedata()')" value="Submit" />

这样变量将传递给process.php,同时你也可以在process.php中重定向页面

header("Location:URL");
相关问题