0

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?

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by zubaircs
0

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.

0

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

-1

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,

Votes + Comments
stop necroposting
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.