Jump to content

[SOLVED] emtpy page


spooke2k

Recommended Posts

Hi i have a page that is created from php ,  and basically i need to empty the entire screen screen of data when a current condition is met for instance say they enter b in a input box and hit select i then want to echo "b" and loose the form etc so the page only has b on it.  this is a simplied example of what i want and it has to be on the same php page.

 

Thanks

 

Spooke2k

 

this is example what i want

if(isset($_POST['group2'])) {

 

//Selected Screen  only show echo rest blank

echo "b";

}else{

 

//form code here

}

 

just example its not my actual coding

 

 

Link to comment
Share on other sites

thats the issue the code spans for over 1000 lines and i dont want to post it all  ::)

 

The long and short of it is this its one form for entire thing with about 5 php code sets it needs to be one page and i need to emtpy form i cant use mulpile forms because of how it is supposed to be emplemented. so i guess i need to find a way to emtpy the form to get what i need done.

 

Link to comment
Share on other sites

To empty the form is different from not showing the form as you suggested on your first post

i need to empty the entire screen screen of data
. In that case imagine you have a textfield:

<input name="textfield" type="text" id="textfield" value="hello" />

 

You might want to add something like:

<input name="textfield" type="text" id="textfield" value="<?php if ($_POST['something']) echo ""; ?> />

 

Link to comment
Share on other sites

thanks but you are seting the input box as nothing imagien on a more complicated menu system using a table with 50 of fields about 30 radio buttons and about 50 images in the form to do that 2, is it possible to include such an action in the form properites itself ?. 

 

as to set that method to the objects wont work i dont think, thanks for idea but its the table grid i cant get rid of and need to and images etc.

 

Sorry about this but thanks for helping the issue lies with how i have been told to produce the system but i have to do it this way.

 

:(

 

so any other ideas reallt appeciated

Link to comment
Share on other sites

Im now a little confused. Are you trying to empty a form of all its values? Or are you trying to not display any more information?

 

If its the latter, then i think its already been explained. You need to do something like:

 

<?php
//no output before this line
if($_POST['yourfield'] == 'b'){
echo 'b';
}else{
//ALL the rest of your code
}
?>

 

Or, alternatively:

 

<?php
//no output before this line
if($_POST['yourfield'] == 'b'){
echo 'b';
exit;
}
//the rest of your code
?>

Link to comment
Share on other sites

sorry to confuse

 

<form name="post1" action= <?php echo $_SERVER[php_SELF]; ?> method="POST">

<INPUT name="code" value="" TYPE="hidden">

 

This is where form is set, for all intensive purposes there is no out put before i do this

 

session_start();

 

if( $_POST['submit_button']=='Submit')

{

 

if(($_POST['submit_button']=='Submit')  &&  isset($_POST['group2'])) {

 

//Selected Screen Emtpy old table it doesnt do this it outputs the echo but holds the table data and screen created in part 2 

echo "works";

 

}else{

 

//load table page values

//Part 2

}

 

Far as i can see it should just drop the html and rest in part 2 but it doesnt it holds it and that problem

 

I hope this helps show what i am doing and where it is going wrong 

 

 

Link to comment
Share on other sites

Your still trying to hide the form, correct?

 

See if this gives you what you want:

 

<?php
session_start();

if( $_POST['submit_button']=='Submit'){

   if(($_POST['submit_button']=='Submit')  &&  isset($_POST['group2'])) {
   
   echo "works";
   
   }else{

    }
} else {

    echo "<form name='post1' action='{$_SERVER['PHP_SELF']}' method='POST'>";
    echo '<INPUT name="code" value="" TYPE="hidden">';
}

?>

Link to comment
Share on other sites

the array way ok.

 


<?php

if($_POST['submit']){

foreach($test as $x){

if(is_numeric($x)){

echo "<br>correct<br>";

}else{

echo "<br>incorrect<br>";

}
}
}
   
?>


<form method="POST" action="">
<input type="text" name="test[]">
<input type="text" name="test[]">
<input type="text" name="test[]">
<input type="text" name="test[]">
<input type="text" name="test[]">
<input type="text" name="test[]">
<input type="submit" name="submit" value="test">
</form>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.