I am having one button1, when click on it another button2 comes. when click on button2 i am showing an image on the right side. But the button2 is disappearing. I want all the buttons to be present in the page. Please help whats going wrong in this.

<form method="post" action="">
<input type="submit" name="submit_base" value="Style">
</form>

<?php
if(isset($_POST['submit_base']))
{ ?>

<form method="post" action="">
<input type="submit" name="submit1" value="Style1">
</form>

<?php
}
?>

<?php

if(isset($_POST['submit1']))
{
$imagepath = "shirt7.jpg";
echo "<img style='float:right;' src='$imagepath' />";
?>

}
?>

The image is coming but style1 button is going off (disappearing). How can I retain the buttons.

Member Avatar for diafol
if(isset($_POST['submit_base']) || isset($_POST['submit1'])){

instead of

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

However, do you need all the different forms? COuld you not place all the buttons in the one form, like this?

<form method="post" action="">
<input type="submit" name="submit_base" value="Style">
<?php
if(isset($_POST['submit_base']) || isset($_POST['submit1'])){
?>
<input type="submit" name="submit1" value="Style1">
<?php
}
?>
</form>

You could even use javascript for this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.