SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay simple question here, but since I've just started with PHP, mySQL, am not too sure how I should tackle this.

    We have a database with a USER table in it. The USER table, amongst other things, has a field called NEWS which is one character long and holds either a 'Y' or 'N' depending on the user's preference to receive mail.

    I want to provide the user the option to change this setting at will when they login to our site. So for instance, if I am registered, and receive a newsletter, all I have to do to unsubscribe is login, and select 'N' (in a drop down list? - or whatever...) to change the setting.

    Now my question is how should I tackle this...
    How will the PHP part (to connect and change the field for the user) fir in with the HTML portion of the website?

    Any ideas/help/references would be appreciated.

    Thanks.

  2. #2
    SitePoint Member
    Join Date
    Mar 2001
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Something like this???

    Hi
    I'm a beginner, so I dont know how much help this will be.

    Write the html file with php script in it. Since user has already logged in you can identify user in database with the help of id and password field. Now with that select the value of the news field.
    (start php)
    If = Y then (end php) small html subit button named unsubscribe. (start php ie <?php)
    if value = subscribe change database entry
    else (end php)html button named subscribe.
    (start php) If clicked the database entry is changed accordingly.

    You may use echo($PHP_SELF) command to reload same page on button being clicked.

  3. #3
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm that does make sense...
    I'll try it and will post here if it does (or does not!) work.

    Thanks!


Bookmarks

Posting Permissions

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