LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   why the html <form> doesn't disappear after using it (https://www.linuxquestions.org/questions/programming-9/why-the-html-form-doesnt-disappear-after-using-it-802173/)

a7mlinux 04-15-2010 07:57 AM

why the html <form> doesn't disappear after using it
 
hi LQs, I'll try to explain the situation simply.
I have a HTML <form> with two (input type text), and a submit button, after I enter the two values and click submit button, the x.php appear successfully but the HTML <form> still remain in the x.php page, can you tell me how to hide the form from the x.php page
:)

PMP 04-15-2010 08:00 AM

Check of submit button. The code to print form should be conditional.

If your submit is defined do not show the form

a7mlinux 04-15-2010 08:06 AM

I don't think it is conditional, I just take the values and execute a Mysql query, the data fetched successfully from the database and the form I used to fetch data doesn't disappear, should it??, or I forgot to do something??

PMP 04-15-2010 08:20 AM

Yes, It should be conditional in case you want to hide if after posting the form.

a7mlinux 04-15-2010 08:27 AM

appreciate your help, i think the condition should be in from.html right??
but what is the condition should be??
Code:

.
.
.
.
.
.
.


PMP 04-15-2010 08:44 AM

Please post the relevant section of the code.

a7mlinux 04-15-2010 09:33 AM

here is the form code (simplified I just pasted the main tags):
search form.html
Code:

<script language="javascript">
function redirect(){
window.location ="show data.php"
return
}
</script>
<form method="POST" action="show data.php">
<div id="wb_Text1" style="position:absolute;left:322px;top:39px;width:114px;height:14px;z-index:0;" align="left">
<font style="font-size:11px" color="#000000" face="Arial">search by name </font></div>
<input type="text" name="name">
</input>
<div id="wb_Text2" style="position:absolute;left:323px;top:90px;width:94px;height:14px;z-index:2;" align="left">
<font style="font-size:11px" color="#000000" face="Arial">search by #</font></div>
<input type="text" name="docNo"></input>
<input type="submit" id="Button1" name="Button1" value="OK" onClick="redirect()" >
</form>

and the show data.php:
Code:

$docNo = $_POST['docNo'];
$name = $_POST['name'];
$result = mysql_query("SELECT * FROM employee WHERE docNo = '$docNo' OR name = '$name'");
include('search form.html');

it works, but the search form.html appear in show data.php

PMP 04-16-2010 01:16 AM

Is there any specific reason to include search_form.html in show_data.php ?
If not try commenting it out. this will stop showing the form on show_data.php.


All times are GMT -5. The time now is 12:38 AM.