简体   繁体   English

单击按钮打开PHP页面

[英]Open PHP Page On Button Click

I wonder whether someone could help me please. 我想知道是否有人可以帮助我。

I'm put together the following form contained within a PHP file. 我将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>

It all works fine, but I'd now like to add a button that opens the following php page, 'blobupload.php'. 一切正常,但是我现在想添加一个按钮来打开以下php页面“ blobupload.php”。 If I've understood this correctly from the research that I've done, I need to use javascript to open the page, using the 'submit' action from the main form. 如果我从所做的研究中正确理解了这一点,则需要使用javascript,通过主表单中的“提交”操作打开页面。

What I don't understand is how to do this when the 'submit' action is already taken for the saving of the information on the main form. 我不明白的是,当已经执行“提交”操作以将信息保存在主表单上时,该怎么做。

Could someone perhaps please show me how to get around this, ie using the same 'submit action but for two different purposes. 可能有人可以告诉我如何解决此问题,即使用相同的“提交动作”但出于两个不同的目的。

Just modify your form tag (add the action attribute to file you want to load): 只需修改表单标签(将action属性添加到要加载的文件中):

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

And you submit input tag: 然后提交输入标签:

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

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

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

Use php to process the form is one of the way to do it. 使用php处理表单是其中一种方法。

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

that way the the variable will be passed to the process.php while you can also redirect the page in the process.php 这样,变量将被传递到process.php,同时您也可以在process.php中重定向页面

header("Location:URL");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM