Link to home
Start Free TrialLog in
Avatar of Lennart Ericson
Lennart EricsonFlag for Sweden

asked on

A very basic form and php question.

I am asking this question with blushing face; it is really basic, but I don't get this right. Pleas help me!

Processing the attached piece of code, I had expected to get a result like
Mailadress: tester@my_domain.com
Mailadress: tester@my_domain.com
Testmailadress: tester@my_domain.com

Instead I get:
Mailadress: tester@my_domain.com

Notice: Undefined variable: testmailadress in E:\admin\install\test_2.php on line 6

Notice: Undefined variable: testmailadress in E:\admin\install\test_2.php on line 7
Mailadress:
Testmailadress:

What is wrong?
Why isn't "Mailadress: tester@my_domain.com" repeated after I try to equal $_POST[mailadress] to $testmailadress in the code? Why does $_POST[mailadress] seem to disappear?

It is probably simple yet I am confused. Please help.
<?php
error_reporting(E_ALL|E_STRICT); 
ini_set('display_errors', '1');

echo "Mailadress: $_POST[mailadress]<br />";
$_POST['mailadress'] = $testmailadress; 
echo "Mailadress: $_POST[mailadress]<br />Testmailadress: $testmailadress<br />";
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Member_2_248744
Member_2_248744
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lennart Ericson

ASKER

Thanks, you tought me an important piece of knowledge today:
$testmailadress = $_POST['mailadress'];  is not the same as $_POST['mailadress'] = $testmailadress;
That made the trick.
Thanks so much!
Avatar of Dave Baldwin
Like Slick812 said....
<?php
error_reporting(E_ALL|E_STRICT); 
ini_set('display_errors', '1');

echo "Mailadress: $_POST['mailadress']<br />";
$testmailadress = $_POST['mailadress']
echo "Mailadress: $_POST['mailadress']<br />Testmailadress: $testmailadress<br />";
?>

Open in new window