3
I’m having a little problem, I’m creating an app and I intend to have two Forms on the same page. It turns out that when I run the first one, I have no problems, but when I run the second one, the first one is done again, and since there is no data there is an error. To try to get around this problem I created an Hidden input:
<input type="hidden" name="opti" value="1">
<input type="hidden" name="opti" value="2">
<input type="hidden" name="opti" value="3">
The first line being on the first form and the other two are on the second. I intended that although they were on the same page they did not conflict and for this I created a cycle if:
if (isset($_POST['opti']) == '1')
{
// Executa o calculo quando existir
if ($_SERVER['REQUEST_METHOD']== "POST")
{
$fabric = $_POST['Fabric'];
$spare = $_POST['Spare'];
$xres = $_POST['Xres'];
$yres = $_POST['Yres'];
$mspeed = $_POST['Mspeed'];
$lents = $_POST['Lents'];
$sensor = 1280;
Calculos
}
}elseif (isset($_POST['opti']) == '2')
{ tabela}
So when I press the first form, I can perform all calculations without problem, but then when I want to create the table, with the second form, returns me to execute the first and as the fields are blank gives error.
Thank you.
Page code is here: http://jsfiddle.net/akjs061o/
Put the rest of your code here, the full page.
– KhaosDoctor
add the code of
<form>
, only with the<input>
it’s hard to know the problem– Pedro Sanção
To run your code in PHP, you can publish on this site: http://www.viper-7.com/rCOpJR
– Ivan Ferrer
That one
Calculos
is breaking your code.– Ivan Ferrer
This word Calculus is only to indicate that calculations are made in this space, because it is the only thing that I cannot show. I ask you to understand. Thank you.
– Pedro Lima
There is a conceptual problem in the question. They are not PHP Forms, they are HTML Forms like any other. PHP only processes their output (this would help understand the problem). Starting from this, there is another thing: the problem may be in HTML, which was not posted in the question. It would be legal [Dit] to ask the question and put all the relevant part. It is an apparently simple problem to solve, but the lack of information makes it difficult.
– Bacco
Hello Bacco, first of all thank you for your interest. My entire website is here: http://jsfiddle.net/akjs061o/ as stated above, only the calculations are not present. If you know how to solve the problem would appreciate a tip. Thank you
– Pedro Lima