Jacob Salomons Posted December 22, 2006 Share Posted December 22, 2006 Hi AllI am very new to the php language. My burning question right now is: Are form input names prescribed by php syntax or can I define my own e.g. name , telephone numbers etc.I appreciate any help that I can get. Additionally can any one recommend a book designed for a dummy like me?Thanks all and have a great holiday.Jake Link to comment https://forums.phpfreaks.com/topic/31605-mail-form-parameters/ Share on other sites More sharing options...
utexas_pjm Posted December 22, 2006 Share Posted December 22, 2006 Input names can be whatever you wish. You can access any submitted input value via the $_REQUEST array as shown below: [code]<?php$submitted = $_REQUEST['sent'];if($submitted){ $phone = $_REQUEST['telephone']; echo 'Your phone number is ' . $phone;}?><form action='index.php'><input type='text' name='telephone' /><input type='hidden' name='sent' value='1'/><input type='submit'></form>[/code]Notice that the index of the array is denoted by the name of the input element. This holds true for any data submitted via POST or GET.As far as literature you can get alot of information for free looking through the tutorials for beginners on PHP sites. I haven't personally looked through the tutorials on this site but that'd probably be a good place to start. Best of luck,Patrick Link to comment https://forums.phpfreaks.com/topic/31605-mail-form-parameters/#findComment-146499 Share on other sites More sharing options...
kenrbnsn Posted December 22, 2006 Share Posted December 22, 2006 You should not use the [b]$_REQUEST[/b] superglobal array in most cases. Use the [b]$_GET[/b] array to get values from the URL and from forms using the GET method (the default). Use the [b]$_POST[/b] array to get values from forms that use the POST method.Ken Link to comment https://forums.phpfreaks.com/topic/31605-mail-form-parameters/#findComment-146503 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.