lucerias Posted September 18, 2006 Share Posted September 18, 2006 I have created one parameter.html and parameter.php as the following, but i can't pass the parameter from html to php. I have gone through the code for many times and there is no spelling error.parameter.html<HTML><HEAD></HEAD><BODY><FORM METHOD=GET ACTION="parameter.php">Who is your favourite author?<INPUT NAME="Author" TYPE="TEXT"><BR><BR><INPUT TYPE=SUBMIT></FORM></BODY></HTML>parameter.php<HTML><HEAD></HEAD><BODY>Your favourite author is:<?phpecho $Author;?></BODY></HTML> Link to comment https://forums.phpfreaks.com/topic/21133-pass-parameter-from-html-form-to-php/ Share on other sites More sharing options...
onlyican Posted September 18, 2006 Share Posted September 18, 2006 FirstYou have method=getYou need some quotes round the getmethod="get"SecondYou are using the GET method, therefor you need to call the var with that<?phpecho $_GET["Author"];?>If you were using method='post'then you show the function using$_POST["Author"]; Link to comment https://forums.phpfreaks.com/topic/21133-pass-parameter-from-html-form-to-php/#findComment-93851 Share on other sites More sharing options...
lucerias Posted September 19, 2006 Author Share Posted September 19, 2006 Thanks, it works. What if i want to display the parameter together with a string? Link to comment https://forums.phpfreaks.com/topic/21133-pass-parameter-from-html-form-to-php/#findComment-94343 Share on other sites More sharing options...
lucerias Posted September 19, 2006 Author Share Posted September 19, 2006 Is there any way apart from this $_GET["Parameter"]? It is because i read a book and the example in book is done in this way: echo $Author. Thank you. Link to comment https://forums.phpfreaks.com/topic/21133-pass-parameter-from-html-form-to-php/#findComment-94356 Share on other sites More sharing options...
redarrow Posted September 19, 2006 Share Posted September 19, 2006 [code]parameter.html<HTML><HEAD></HEAD><BODY><FORM METHOD="post" ACTION="parameter.php">Who is your favourite author?<INPUT NAME="Author" TYPE="TEXT"><BR><BR><INPUT TYPE=SUBMIT></FORM></BODY></HTML>parameter.php<HTML><HEAD></HEAD><BODY>Your favourite author is:<?phpecho $Author;?></BODY></HTML>[/code] Link to comment https://forums.phpfreaks.com/topic/21133-pass-parameter-from-html-form-to-php/#findComment-94436 Share on other sites More sharing options...
lucerias Posted September 19, 2006 Author Share Posted September 19, 2006 Sorry, is there any difference between the coding i provided and you posted later. I have already tried but it can't work. Thank you. Link to comment https://forums.phpfreaks.com/topic/21133-pass-parameter-from-html-form-to-php/#findComment-94499 Share on other sites More sharing options...
onlyican Posted September 19, 2006 Share Posted September 19, 2006 Its to do with global register settingsIn older versions of php, global_register used to be turned on, there for, you can call $_POST, $GET, $_SESSIONS by using the namebut this is now turned off, and I believe in V5 (maybe V6) You dont even have an option to turn it onThe reason being, is it opens you up to hack attemptsSo the book your reading was probs created when using the older versions of PHP Link to comment https://forums.phpfreaks.com/topic/21133-pass-parameter-from-html-form-to-php/#findComment-94528 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.