Lennart Ericson
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.ph p on line 6
Notice: Undefined variable: testmailadress in E:\admin\install\test_2.ph p 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.
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.ph
Notice: Undefined variable: testmailadress in E:\admin\install\test_2.ph
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 />";
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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 />";
?>
ASKER
$testmailadress = $_POST['mailadress']; is not the same as $_POST['mailadress'] = $testmailadress;
That made the trick.
Thanks so much!