0

I want to display a set of buttons when a button is pressed on the page. whats wrong in this code. it's giving errors

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

<form method="post" action="">
<input type="submit" name="submit2" value="Style2">
</form>

<form method="post" action="">
<input type="submit" name="submit3" value="Style3">
</form>

<form method="post" action="">
<input type="submit" name="submit4" value="Style4">
</form>

<form method="post" action="">
<input type="submit" name="submit5" value="Style5">
</form>

<form method="post" action="">
<input type="submit" name="submit6" value="Style6">
</form>

}
?>

<form method="post" action="">
<input type="submit" name="submit" value="Style">
</form>
4
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by veedeoo
0

What errors are you getting? Also the button never gets set because you do not tell the form where to post to.

0

Hi, change your codes to this

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

<form method="post" action="">
<input type="submit" name="submit2" value="Style2">
</form>

<form method="post" action="">
<input type="submit" name="submit3" value="Style3">
</form>

<form method="post" action="">
<input type="submit" name="submit4" value="Style4">
</form>

<form method="post" action="">
<input type="submit" name="submit5" value="Style5">
</form>

<form method="post" action="">
<input type="submit" name="submit6" value="Style6">
</form>

<?php
}
?>

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

You cannot put html tags within the php tags, without echo or print or better yet close the php tags and then re-open where it is needed as shown on your modified codes I have provided.

0

when i am pressing style1 the original page is coming with 'style' button. why is it? there's nothing should come right ? whats wrong

0

when i am pressing style1 the original page is coming with 'style' button. why is it? there's nothing should come right ? whats wrong

put your style button within the else statement like

<?php
}
else{
?>
<form method="post" action="">
<input type="submit" name="submit" value="Style">
</form>
<?php
}
?>

Just to remind you that you cannot double post on the same type of question. That will throw off a lot people here, who are just trying to help you..

It could be this post, or the other one that you've just started.. you choice..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.