Jump to content

Little Problem Html<>php Variable


nachtegaal9999

Recommended Posts

HoiI have a question , somebody fills in his name on my website in fieldname "htmlname"Code<html><body><br><input type="text" name="HTMLname" /><br>Next , i want to declare this input as a php variable with the next php code: <?php$PhpVarNaam='HTMLnaam'; echo Filled in name : $PhpVarName;?>This isn't correct, i get "HTMLname" as result, but this is wrongWho can help with this little issue?Thanks in advance

Link to comment
Share on other sites

first of all, your input field has to be within a form... and make a submit button...like this

<form action='mypage.php' method='post'><input type="text" name="HTMLname" /><input type='submit' name='submit' value='submit'></form>

what this code means is that when you hit the submit button, it will load "mypage.php" and give $_POST['HTMLname'] the value that is enteredso on mypage.php you could have the code

<?php$PhpVarName=$_POST['HTMLname']; echo "Filled in name : ".$PhpVarName;?>

and make sure you spell stuff correct....

Link to comment
Share on other sites

If you just want to pass data from page to page generally, use sessions.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...