PHP help for a newbie..
Moderator: General Moderators
PHP help for a newbie..
Alright.. I am a PHP newbie. I don't know much about it. =) What im trying to do is have a form be submited by PHP when "send" is clicked. What do I need to do? How is this possible? Is it possible? Right now I use Yahoo's Web Hosting Service.
the child-Elements of a form may have a name-property ( <input type="text" name="text1" /> ).
When the form is submitted all name/values-pairs of those elements will be sent to the webserver using the format according to the method/enctype - property of the form-element.
i.e.when this form is submitted,
- itemId (=8765)
- comment (=what ever the user wrote into the field)
- rating (= the value of the radio-button the user chose)
will be sent
The method of the form-action is 'get'. So in your php-script the parameters will be accessable through the superglobal array $_GET ( $_GET['itemId'], $_GET['comment'] & $_GET['rating'] )
if method would've been 'post' they had been stored in the $_POST array.
$_REQUEST contains all the parameter wether they were sent by 'get' or 'post'
You may also name the submit-button (<input type="submit" name="submit" value="itemDesc">) to identify the form-request
these arrays have been introduced with php 4.1. If you're using an older version take a look at the notes in the reference
When the form is submitted all name/values-pairs of those elements will be sent to the webserver using the format according to the method/enctype - property of the form-element.
i.e.
Code: Select all
&lt;form method="get"&gt;
&lt;input type="hidden" name="itemId" value="8765" /&gt;
&lt;input type="text" name="comment" /&gt;
&lt;input type="radio" name="rating" value="nice" /&gt;
&lt;input type="radio" name="rating" value="fair" /&gt;
&lt;input type="radio" name="rating" value="bad" /&gt;
&lt;input type="submit" /&gt;
&lt;/form&gt;- itemId (=8765)
- comment (=what ever the user wrote into the field)
- rating (= the value of the radio-button the user chose)
will be sent
The method of the form-action is 'get'. So in your php-script the parameters will be accessable through the superglobal array $_GET ( $_GET['itemId'], $_GET['comment'] & $_GET['rating'] )
if method would've been 'post' they had been stored in the $_POST array.
$_REQUEST contains all the parameter wether they were sent by 'get' or 'post'
You may also name the submit-button (<input type="submit" name="submit" value="itemDesc">) to identify the form-request
Code: Select all
...if (array_key_exists('submit', $_REQUEST))
handleRequest();
else
printForm();
...if ypur looking forfree space with php and mysql try http://www.tripod.lycos.co.uk/ they now do php and mysql and they have a very similar set up to yahoo.