Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts

    getitng users dob and sex into db

    hey guys little stuck with this one wundering if any 1 has code i could use/edit

    i need to have my form so users can add their dob and age into a db

    i have no idea how to do this... i would like it so male/female can be chose so it chnages a colour so male = blue female = pink
    and dob displays like so day/month/year

  • #2
    Banned
    Join Date
    Feb 2008
    Location
    Winnipeg, Canada
    Posts
    396
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Do you have code for getting the rest of the user's information into your database ?

  • #3
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    at the moment i use this

    PHP Code:
    <?php
    session_start
    (); 
        require_once 
    '../../settings.php';
            
    checkLogin ('1 2');
    $id $_SESSION['user_id'];

    $qProfile "SELECT * FROM users WHERE id='$id'  ";
    $rsProfile mysql_query($qProfile);
    $row mysql_fetch_array($rsProfile);
    extract($row);
    $dob = ($dob);
    $about_me = ($about_me);
    $events = ($events);
    $first_name = ($first_name);
    $last_name = ($last_name);

    mysql_close();?>

    <form id="FormName" action="updated.php" method="post" name="FormName">
    <table width="448" border="0" cellspacing="2" cellpadding="0">
    <tr><td width="150"><div align="right">
    <label for="dob">dob</label></div>
    </td>
    <td>
    <input id="dob" name="dob" type="text" size="25" value="" maxlength="255"></td>
    </tr>
    <tr><td width="150"><div align="right">
    <label for="about_me">about_me</label></div>
    </td>
    <td>
    <textarea id="about_me" name="about_me" rows="4" cols="40"><?php echo $about_me ?></textarea></td>
    </tr>
    <tr><td width="150"><div align="right">
    <label for="events">events</label></div>
    </td>
    <td>
    <input id="events" name="events" type="text" size="25" value="<?php echo $events ?>" maxlength="255"></td>
    </tr>
    <tr><td width="150"><div align="right">
    <label for="first_name">first_name</label></div>
    </td>
    <td>
    <input id="first_name" name="first_name" type="text" size="25" value="<?php echo $first_name ?>" maxlength="255"></td>
    </tr>
    <tr><td width="150"><div align="right">
    <label for="last_name">last_name</label></div>
    </td>
    <td>
    <input id="last_name" name="last_name" type="text" size="25" value="<?php echo $last_name ?>" maxlength="255"></td>
    </tr>
    <tr>
    <td width="150"></td>
    <td><input type="submit" name="submitButtonName" value="Update"><input type="hidden" name="id" value="<?php echo $id ?>"></td>
    </tr>
    </table>
    </form>
    to update it wich goes onto

    updated.php

    PHP Code:
    <a href="index.php">Back to List</a><br>
    <br>
    <?php


    include("connect.php");

    $id $_POST['id'];
    $dob $_POST['dob'];
    $about_me $_POST['about_me'];
    $events $_POST['events'];
    $first_name $_POST['first_name'];
    $last_name $_POST['last_name'];

    $update "UPDATE users SET dob = '$dob', about_me = '$about_me', events = '$events', first_name = '$first_name', last_name = '$last_name' WHERE id='$id' ";
    $rsUpdate mysql_query($update);
    if (
    $rsUpdate)
    {
    echo 
    "Update successful.";
    mysql_close();
    ?>

  • #4
    Regular Coder
    Join Date
    Nov 2006
    Posts
    601
    Thanks
    1
    Thanked 2 Times in 2 Posts
    any ideas any 1?

    all i want to do simpky is add users date of birth and sex into a db


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •