1

test.html

<html>
<head>
<title>test</title>
</head>
<body>
<form name="form1" method="post" action="testout.php">
irum1 : <input type="text" name="irum1" size="20" value="">
<input type="submit" value="Send">
</form>
</body>
</html>

testout.php

<html>
<head>
<title>testout</title>
</head>
<body>
  getting irum1 = <?=$irum1?>
</body>
</html>

result (when I input "Hello php")

getting irum1 =  

it should be

getting irum1 = Hello php

Above codes are about sending parameter that user input to another page. but the code is not working. I couldn't see the parameter. I'm on doing this work by apm (apache+php+mysql). What is the problem? I'm newbie on php.

Thanks.

2 Answers 2

2

When you submit a form, you're sending an array of data via the method defined by the form. In this case POST.

You have to grab 'irum1' form data out of the POST array before you can use it.

On testout.php

<?php $irum1 = $_POST['irum1'] ?>

<html>
<head>
<title>testout</title>
</head>
<body>
  getting irum1 =  <font color="blue"><?=$irum1?></font>
</body>
</html>
Sign up to request clarification or add additional context in comments.

Comments

1

You are passing the value correctly to the page , but you are not retrieving it on the other page.

On your testout.php do this change..

<html>
<head>
<title>testout</title>
</head>
<body>
  getting irum1 = <?php echo isset($_POST['irum1']) ? $_POST['irum1'] : "Value not passed";?>
</body>
</html>

1 Comment

Thank you. It's working well. But I typed correctly compare to my php book. Can you explain to me what's the difference your code and my code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.