RevCMS Related Help

Results 1 to 6 of 6
  1. #1
    Newbie Santacruz is offline
    MemberRank
    Nov 2013 Join Date
    12Posts

    RevCMS Related Help

    Hi there RageZone,

    I am trying to create a website for educational purposed, this means that it will not be related to Habbo. But since I am using RevCMS, I hope someone can help me out. Any help will really be appreciated.

    I am posting this thread because I am having problems in "Dorp Selection on register", you might be confused what is that, don't worry ill explain in the core of the thread, keep reading.. alright, I have succeeded in adding the Dorp Selection to my database.

    Table information explained below:
    Code:
    Field: dorp
    Type: Enum
    Values: 'Doctor','Patient'
    Collation: latin1_swedish_ci
    Here, "dorp" means doctor or patient.

    You might be thinking what help do I need with this. Well, I want to do such that when someone goes to the registration page it shall show two labels named Doctor or Patient, where the user can only select one out of them and when that user registers the data should be imported to the MySQL Database.

    NOTE: I need help related to the PHP, not the MySQL Code, I have already created the table under the users category.

    How can I help you though?: You can help me by just posting the code below or uploading on some file sharing website. I would like the code for "register.php" & "class.users.php". Since, those are the only two files which will be needed to be edited in this condition.

    Why should I help you?: I am not as professional as you guys are in programming and I really need some help from you guys since I know this is a very big gaming community which I guess can surely help me out.

    I know it might take some time, but take your time.

    Thank you very much for spending your precious time reading my thread.

    And yes, please excuse my English. I know it is bad.

    Thanks in advance.

    Seeking your co-operation,
    Santacruz.


  2. #2
    Newbie Santacruz is offline
    MemberRank
    Nov 2013 Join Date
    12Posts

    Re: RevCMS Related Help

    1 day passed, no reply. Come on? Someone, who can help me out?

  3. #3
    :joy: Jonteh is offline
    Grand MasterRank
    Apr 2007 Join Date
    New York, USALocation
    3,372Posts

    Re: RevCMS Related Help

    So you want a drop down box for a registrant to be able to choose, options being Doctor or Patient and when the user clicks register, it inserts the selection into the db?

  4. #4
    Newbie Santacruz is offline
    MemberRank
    Nov 2013 Join Date
    12Posts

    Re: RevCMS Related Help

    Quote Originally Posted by Jonteh View Post
    So you want a drop down box for a registrant to be able to choose, options being Doctor or Patient and when the user clicks register, it inserts the selection into the db?
    That's exactly what I want.

  5. #5
    :joy: Jonteh is offline
    Grand MasterRank
    Apr 2007 Join Date
    New York, USALocation
    3,372Posts

    Re: RevCMS Related Help

    Quote Originally Posted by Santacruz View Post
    That's exactly what I want.
    http://www.w3schools.com/html/html_forms.asp

    You can learn how to add the drop down box there. You'll just need to add the $_POST's in php to the insert query when a user registers.

  6. #6
    Elite Member Pastie is offline
    Member +Rank
    May 2014 Join Date
    FranceLocation
    133Posts

    Re: RevCMS Related Help

    Hey there @Santacruz
    All you actually have to do is create a "Dropdown" or <select> HTML tag with a name like "type".
    Then you have to create options for the user to select with a value like Doctor or Patient.
    You then need to create a PHP script that inserts the form into the database.
    Here is a simple script that I just coded with a dropdown menu where you can choose from Doctor to Patient. Keep in mind that you have to update your Enum table in the database to: '0','1','2' for this script to work like the following image shows:


    Then you just create a file called register.php and insert this following HTML code:
    <!doctype html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>Register Script by Invitee</title>
    </head>


    <body>
    <form action="process.php" method="POST">
    <p><strong>ID:</strong><br />
    <input type="text" name="id"/></p>
    <p><strong>FirstName:</strong><br />
    <input type="text" name="firstname"></p>
    <p><strong>LastName:</strong><br />
    <input type="text" name="lastname"></p>
    <p><strong>Username:</strong><br />
    <input type="text" name="username"></p>
    <p><strong>Password:</strong><br />
    <input type="password" name="password"/></p>
    <select name="type">
    <option value="doctor">Doctor</option>
    <option value="patient">Patient</option>
    </select>
    <p><input type="submit" name="submit" value="Register"/></p>
    </form>
    </body>
    </html>
    Then create a new PHP file called process.php with the following code:
    <?php


    mysql_connect("localhost", "root", "") or die (mysql_error());
    mysql_select_db("option") or die (mysql_error());
    if(isset($_POST['submit'])){
    $type=2;

    if($_POST['type'] == "doctor")
    $type = 1;
    if($_POST['type'] == "patient")
    $type = 2;

    $sSql = "INSERT INTO users ( id, first_name, last_name, username, password, dorp) VALUES ('$_POST[id]', '$_POST[firstname]', '$_POST[lastname]', '$_POST[username]', PASSWORD(\"$_POST[password]\"), $type)";

    mysql_query($sSql);

    echo '<h2>USER REGISTERED</h2><br />';
    }

    ?>
    Remember to change MySQL configuration!
    Then go to: localhost/register.php or whereever you saved it and create a user. Keep in mind since this is only a simple demo the script is only tested on localhost and is not secured properly.

    Some screenshots:





    Image above registered with doctor "dorp". You can see in the dorp table it says 0 for doctor and 1 for patient that shows in the following image:


    Need anymore help securing the script or with other simple PHP stuff PM me :)

    Good luck with your project!
    Regards,
    Invitee.



Advertisement