Jump to content

oliverj777

Members
  • Posts

    98
  • Joined

  • Last visited

    Never

Posts posted by oliverj777

  1. Hi, I'm trying to make an error message appear when a user misses a text field, or fills in an error. All the errors are sent to a form.php, this then sends the error message back to the current page. Here is the code I am using to retrieve the error message:

     

    if($form->error = ("user")){
    echo $form->error("user");
    }
    if($form->error = ("pass")){
    echo $form->error("pass");
    }

     

    Which works fine, but I only want ONE error message to be displayed at a time. This IS what I want:

     

    There are two fields, user, and password. If the user fails to enter anything into both, only one error message will appear "Please enter your username" (which is what the form.php does).

     

    When the user fills in the username, but fails to fill in the password then it works, only one error message appears (as there is only one error to send)

     

    When the user fills in the password, but fails to fill in the username it also works, only one error message appears. Its just when the user fails to fill in either, it prints both error messages when I only want it to print the 'user' error message.

     

    Please help, Thanks

  2. Hello,

     

    I'm working on a register script, and basically I would like the user to repeat their password. And I would like PHP to compare the to passwords, and if they both match then it continues, whereas if they don't match it calls an error. Here is what I have so far:

     

    Form:

    Consists  of 2 text fields - subpass, and subconfirmpass

     

    PHP:

    $field = "subpass";
      if(!$subpass == $subconfirmpass){
    	  $form->setError($field, "* Passwords do not match");
      }

     

    $field is referring to the text fields in where the user inputs their password

    $form is keeping track of errors in user submitted forms and the form field values that were entered correctly.

     

    I would appreciate your help,

     

    Thanks  :D

     

     

  3. Hello,

     

    I have the Jpmaster77 login script with admin features. Now I want to have extra user info on the registration page, such as 'Address', 'City' for now.

    All I have done so far is created a new field within the 'users' table called 'address' (SQL), and because of that, I get a registration failure. I guess I need to tell the script that this field is there, and needs populating.

     

    Any help please!!

     

    Thanks  ;)

  4. Both work, so I'll use either.

     

    $database->updateUserField($session->username,

     

    Is what i'm using to access my session. Because the table in the SQL is different depending on who is logged into the website, and the code determines the location of the columns in the table according to the user.

  5. Bearing in mind,

     

    When I do this:

     

    $website_name = 'hello';
    $database->updateUserField($session->username,"website_name",$website_name);

     

    It works, it places 'hello' into my SQL table. But I want to replace 'hello' with an input field so a user can input anything they want into the table ...

  6. Okay,

     

    Here is the form, where the user input data into the text field:

     

    <form method="post">

      <input name="website_form" type="text">

      <input type="submit" name="button" id="button" value="submit">

    </form>

     

    Then here is the PHP which is suppose to save the data into my SQL table:

     

    <?
    if(isset($_POST['submit'])){
    $_POST = $website_form;
    $_website_form = $website_name;
    $database->updateUserField($session->username,"website_name",$website_name);
    }
    ?>

     

    But the PHP code is completely wrong, I don't know how to tell PHP to save that data from the text field into:

    $database->updateUserField($session->username (this is where the data in my SQL table needs to be saved - the location)

     

    Thanks

  7. Humm,

     

    Maybe I've written the code completely wrong.

     

    All I want to do is save the input data of a text field into my SQL table, which is located by this code:

     

    $database->updateUserField($session->username,"website_name",$subwebsite_name);

     

    (website_name is the name of the field in my table)

    (subwebsite_name is the new data being placed into my table)

     

    Can you pleaseeee help me. To me it sounds like such a simple thing to do, but I've been fighting over it for about 5 hours now ... It's ridiculous.

     

    Thanks ...

  8. Basically, here what I want to happen.

     

    User inputs data into text field (ed, the word "Hello")

    Click submit,

     

    The data is then submitted to SQL, but I already have a table in SQL, and all i want to be done is to update a column of data, so it would now say 'Hello' within the website_name column of my SQL.

     

    Thats it ... Thanks

  9. Hello,

     

    I'm trying to update some data from a text field into an SQL table that already exists. Here is my code:

     

    <?php
    include("include/session.php");
    
    $subwebsite_name = $_POST;
    ?>
    <form name="form" method="post" action="">
      <input name="subwebsite_name" type="text" value="<?=$subwebsite_name;?>">
      <input type="submit" name="button" id="button" value="Submit">
    </form>
    <?
    $database->updateUserField($session->username,"website_name",$subwebsite_name);
    ?>

     

    Please help, I'm sure its an easy fix :)

  10. Hello,

     

    I would like to know how to save data that has been placed within a text field into a .txt file in a particular destination on my server.

     

    Basically:

     

    User inputs data into text field (eg, the word "HELLO")

    Clicks submit

     

    The data is then saved into a .txt file. So the word "HELLO" is saved within the .txt

    (the name of the .txt is not important, it can be any name)

     

    --OR--

     

    The name of the .txt file is called "HELLO" (so the data is saved AS the files name)

     

    Either one works well for me ... As long as I can somehow get PHP to 'echo' the saved data later on (if you can help me with that too  :shy: )

     

    I would really appreciate if anyone can help me,

    Thanks  :D

  11. Basically, when the user submits a page, I want a file to be copied from one directory to another (into the users personal folder on the server) and stay there. But every time the user submits the page, the file is copied again (which I don't want) hence why I placed a if(file_exists).

     

    But it seems that even when the file does exist, the PHP still reads on after the 'else'. Anyway - here is my code. Sure would appreciate someone helping me

     

     

    <?php

    $filename = 'users/$session->username';

    $source = "users/progress_clean.php";

    $destination = "users/$session->username/progress.php";

     

     

    if (file_exists($filename)) {

    echo "File Exists -- Display Included: <br />";

    include ("users/$session->username/progress.php");

    }

    // If the file is found - then I DON'T want the rest of the code to continue (it will over write)

     

    else {

     

      mkdir("users/$session->username/", 0700);       

      if(copy($source, $destination)) {

          echo "File copied successfully. <br />", "\n";

      include ("users/$session->username/progress.php");

      } else {

          echo "The specified file could not be copied. Please try again.", "\n";

      }}

                 

    ?>

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