Hey,
OK, so this might be something, but I seriously cannot find how I went wrong here.
This is my script:

<?php
$_POST['submit'];
$name = $_POST[$name2];
echo "It is going to database <b>db_".$name."</b>";
?>
<br>
</br>
<form action='' method='POST'>
<input type='hidden' name="Example">
<input type='submit' value='What db is it going to?' name='submit'/>
</form>

When the form is submitted, i want the sentence in the echo above to display
"It is going to database db_Example because of the example that the hidden input is named.

Can anyone help me?

Here is example:

<html>
<head>
<title>What db is it going to ?</title>
</head>
<body>
<?php
if(isset($_POST['submit'])){
	$name = $_POST['Exaxmple'];
	echo "<p>It is going to database <b>db_".$name."</b></p>";
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="Example">
<input type="submit" value="What db is it going to?" name="submit" />
</form>
</body>
</html>

Hope that it's what you want.

<?php
$_POST;
$name = $_POST;
echo "It is going to database <b>db_".$name."</b>";
?>
<br>
</br>
<form action='' method='POST'>
<input type='hidden' name="name2" value="Example">
<input type='submit' value='What db is it going to?' name='submit'/>
</form>

This code generate your desired output.

Here is example:

<html>
<head>
<title>What db is it going to ?</title>
</head>
<body>
<?php
if(isset($_POST['submit'])){
        $title=iPhone 5 Cases;

	$name = $_POST['Exaxmple'];
	echo "<p>It is going to database <b>db_".$name."</b></p>";
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="Example">
<input type="submit" value="What db is it going to?" name="submit" />
</form>
</body>
</html>

Hope that it's what you want.

Yes i got it But I am confused my apache give error on launched.Another program used this service i run Skype and other chatting software,

commented: stop necroposting -3
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.