Jump to content

mail form parameters


Jacob Salomons

Recommended Posts

Hi All

I 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

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

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

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.