I have problem that i want to replace a posed value of form with the correct name but not getting the proper text I am only getting the form values i.e. pbs and gs

<?php
include "connect.php";
$school=$_POST;

if ($idevice =="pbs")
{
$tb_school = "Public School";
}
else
{
$tb_device = $school
}

if ($school =="gs")
{
$tb_school = "Government School";
}
else
{
$tb_device = $school;
}
?>

<html>
<body>
<p>School: <?php print_r($tb_school); ?></p>
</body>
</html>

Recommended Answers

All 4 Replies

please help

Without the form code and a better explanation of what your problem is we can't help you. Also, use code tags and indent the code.

where is your form?

by the way, you can consolidate your statements as

<?php
include "connect.php";

if ($idevice =="pbs")
{
$tb_school = "Public School";
}

elseif ($school =="gs")
{
$tb_school = "Government School";
}

else
{
$tb_device = $school;
}

?>
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.