Jump to content

Replace content in the same page


SnakeFox

Recommended Posts

Hello. I really need some help from you guys.

 

I have a page, built upon php and html code alone, that lists products in a table - In administrator view, a form is added below the page, which consists of some textboxes and submit buttons to add new products. The admin enters the input for the name of the product, its category and its supplier, among other information.

 

To input the supplier and category's name, the admin has a drop-down list available - The items in the drop-downs are retrieved from the database. If the supplier he wants to input is not available in the list, he can click on a submit button to add a new supplier - Clicking the button will result on the appearance of a new form that lets the admin input information about the new supplier.

 

Now, here's the catch - I want the table and the original form to disappear so that the admin can only see the new supplier's form. Either that, or open a new page with that form (which is difficult since I have multiple submits with different actions). How do I do either of those? Let me know if you need the actual code.

 

If you post code, can you please make it simple? I'm kind of a newbie when it comes to code complexity (aka functions and classes). Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/111826-replace-content-in-the-same-page/
Share on other sites

why don't you use the boolean expression. Make it true; on click of the submit button. And false when submit is not clicked.

 

<?php
$tabsubmit=true;
// some other functions here

$tabsubmit=false;

// Before your form properties, you  include
<?php if($tabsubmit){ ?>
?>

 

Remember to close with this <?php } ?> after your </form>

 

Use it and let us know what you have.

But how do I assign the whole block of code to the false stament? That's what you're saying right? To assign a boolean variable to the part I want to hide so it can display on "true", and hide on "false"? Lol I'm sorry, I didn't fully understand your idea.

 

Thanks for answering by the way. I really need some help on this.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.