How to add a paragraph whereby PHP

Hi everyone,
I’d like to add my page a paragraph within a certain div.
If a user sends "1"via a form, I want a certain div to add a paragraph that says ‘1’.
Else, I’d like to insert another div a paragraph
That says: ‘2’.
Could anyone help me with that?
Tganks a lot!

there are a few ways you can do about it if your only show what’s been sent you can check for its existence and then show it.

if there is a $_GET called status then show it otherwise print an empty string this is using a tenery
[php]
echo (isset($_GET[‘status’]) ? $_GET[‘status’] : ‘’);
[/php]

same thing but with an if:
[php]
if (isset($_GET[‘status’]){
echo $_GET[‘status’];
}
[/php]

you can wrap a p in these so :

[php]
echo (isset($_GET[‘status’]) ? ‘

’.$_GET[‘status’].’

’ : ‘’);
[/php]

[php]
if (isset($_GET[‘status’]){
echo ‘

’.$_GET[‘status’].’

’;
}
[/php]

or you can use a switch to only respond when the param matches a set:

[php]
switch ($_GET[‘status’]) {
case ‘1’:
echo $_GET[‘status’];
break;
case ‘2’:
echo $_GET[‘status’];
break;

default:
    echo 'no matches'
    break;

}
[/php]

the default can be lost to only respond to matches.

the above examples all use $_GET if your posting then use $_POST

Thank you so much Dave !

Sponsor our Newsletter | Privacy Policy | Terms of Service