Topic: Newbie to php; help with what the different fields mean (Read 372 times)
Google dot what?
Posts: 2
16 credits Members referred : 0
« on: Feb 21, 2007, 07:47:38 AM »
Okay, I really need quite a bit of help -- this is my first ever attempt at a form (much less a php form!)....
I read some other help topics. I found examples of code. I am really trying to figure out what the particular values mean. This is what I have so far:
<?php echo '<form method="get" action="' . $_SERVER['PHP_SELF'] . '"> <table border="0"> <tr> <td>User name:</td> <td><input type="text" name="User name"></td> </tr> </table> <hr> <b>Amount of sleep:</b><br> <table border="0" cellspacing="10px"> <td><input type="radio" name="> 10 hours" value="Print_W"> >10 hours</td> <td><input type="radio" name="8 to 10 hours" value="Web_WO"> 8 to 10 hours</td> <td><input type="radio" name="6 to 8 hours" value="Print_W"> 6 to 8 hours</td> <td><input type="radio" name="4 to 6 hours" value="Web_WO"> 4 to 6 hours</td> <td><input type="radio" name="2 to 4 hours" value="Print_W"> 2 to 4 hours</td> <td><input type="radio" name="Less than hours" value="Web_WO"> Less than 2 hours</td> </tr> </table>
For example, echo '<form method="get" action="' . $_SERVER['PHP_SELF'] is part of the code example I was using. Could someone please tell me what that exactly means so I can make sure I am using the correct values?
Also, in the radio buttons coding, first you enter a name, then value, and then from what I can understand, the last field is how it will display? What exactly does the value mean? (again, that's from example code) Should the name and the display text be the same?
I'm sorry I'm so clueless. Don't be afraid to talk to me as if I were the village idiot. I just really want to learn! Any help would be GREATLY appreciated.
Thanks a ton!
« Last Edit: Feb 21, 2007, 07:50:18 AM by Llally »
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 7975
40807 credits Members referred : 3
« Reply #1 on: Feb 21, 2007, 09:16:09 AM »
First of all, welcome aboard
I will try to answer some of your questions :
Quote
For example, echo '<form method="get" action="' . $_SERVER['PHP_SELF'] is part of the code example I was using. Could someone please tell me what that exactly means so I can make sure I am using the correct values?
From the manual :
The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file.
If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available.
Quote
Also, in the radio buttons coding, first you enter a name, then value, and then from what I can understand, the last field is how it will display? What exactly does the value mean? (again, that's from example code) Should the name and the display text be the same?
Name is the name of the $_GET value, value is the value that this variable will get if you select this radio button, and the last is what you will display. The name and the display text can be different.
Google dot what?
Posts: 2
16 credits Members referred : 0
« Reply #2 on: Feb 21, 2007, 09:32:03 AM »
Nikolas! So nice to see someone responding so fast!
So, I've just been blindly writing this php form flying by the seat of my pants hoping someone would respond! Thank you for the reply.
If only you had some idea how much learning I have to do from you all!
Next set of questions: I was setting up the new table after setting up the database for this form. It was asking me all SORTS of things I had no clue what to put. The fields read as follows: Field TypeDocumentation Length/Values* Attributes Null Default** Extra
Could someone help me out with what to put in these? I've never had to set up a table in MySQL before.
In the above reply, you said 'value' is the value that this variable will get if you select this radio button. Does that mean that in my table there must be a field/value for each value on my form?
I know this is most certainly remedial stuff for you guys but I really appreciate any 'schooling you can give me.
Thanks!
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 7975
40807 credits Members referred : 3
« Reply #3 on: Feb 21, 2007, 10:33:05 AM »
I don't want to disappoint you but mySql is not something that you can learn from forums. Even if we help you somehow - which I don't think is so possible - you would end up with a very slow and security problematic application.
I would suggest you to look for a book regarding mysql.
Until then use something more automated, a CMS/blog system or something that gives you the ability to do what you want without writing much code.