Jump to content

Help me, i'm drowning!


jspencer

Recommended Posts

Hello,

Can't find a 'noob' forum so forgive me if this question is too dumb for words.

I just started learning php last week and at my current stage, learn somthing new with every little paragraph i read.

I am using a mac with apache and MySQL installed and i have an account with 1&1. (i'm not trying to give my life story, just painting a picture of my incompitence.)

I am a big believer in being throw in the deep and learning quickely.

So anyway, I have gone through phpfreak's tutorial about setting up user accounts. It's a great tutorial and it taught me loads of stuff but i can't get passed the information collection form part on page 3. It kind of assumes that you know how to set up the collection forms.
He tells you what it does but does not give any code.

Here is the page i mean: http://www.phpfreaks.com/tutorials/40/2.php

Please help.

Thanks,
J
Link to comment
Share on other sites

thanks for thr link but i am familliar with the html part.

What i don't understand is why the saved html file which is being called by a php command in the next page of the tutorial shows the form but also shows:
****
"You did not submit the following required information!
First Name is a required field. Please enter it below.
Last Name is a required field. Please enter it below.
Email Address is a required field. Please enter it below.
Desired Username is a required field. Please enter it below."
****
...even though I submitted information.

This leads me to belive that there should be some additional code with the forms in the html file. Am i wrong?
Link to comment
Share on other sites

If you read that part on the form example page he explains that he's not doing any form field validation in the form html itself. Instead he's doing the validation in the register.php file that is called when the form is submitted. If there are errors or empty required fields then it will display one or more of those error messages you posted.

What he said:
[quote]This form will post to a script called register.php and will do a few things that are essential. We'll put some basic error checking with PHP. I am not including any special Error checking functions on this form because everyone likes to do error checking their own way. I'll basically be checking that the user entered the required fields of this form and if they didn't, we'll put an error message on the page that they post this form to.[/quote]

The code doing the verification:
[code]/* Do some error checking on the form posted fields */

if((!$first_name) || (!$last_name) || (!$email_address) || (!$username)){
    echo 'You did not submit the following required information! <br />';
    if(!$first_name){
        echo "First Name is a required field. Please enter it below.<br />";
    }
    if(!$last_name){
        echo "Last Name is a required field. Please enter it below.<br />";
    }
    if(!$email_address){
        echo "Email Address is a required field. Please enter it below.";
    }
    if(!$username){
        echo "Desired Username is a required field. Please enter it below.<br />";
    }
    include 'join_form.html'; // Show the form again!
    /* End the error checking and if everything is ok, we'll move on to
    creating the user account */
    exit(); // if the error checking has failed, we'll exit the script!
} [/code]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.