Jump to content

Search the Community

Showing results for tags '$_session session'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. I have a form where a superuser can add a new regular user, or edit or delete the information for a regular user. To make deleting harder, they have to type the word "CONFIRM" in a box to cause the delete to occur. The javascript validation for lengths, dupes, etc. is all working fine, but this last bit of code is not (I realize I could just have the .submit() once in the code block but moved it because I thought that might be the issue (apparantly it isn't). INSERT and UPDATE work fine, but DELETE is never seen for some reason. if (passesvalidation == "true") { if (v_insert == "TRUE" { // Set header alert('DEBUG: Insert Confirmed'); <?PHP $_SESSION['header']='New User Successfully Added"; ?> <?PHP $_SESSION['data_action']='INSERT;?> document.forms["useredit"].submit(); } else { if (v_delete == "CONFIRM") { // Set header alert('DEBUG: Delete Confirmed'); <?PHP $_SESSION['header']='User Successfully Deleted'; ?> <?PHP $_SESSION['data_action']='DELETE';?> document.forms["useredit"].submit(); } else { // Set header alert('DEBUG: Update Confirmed"); <?PHP $_SESSION['header']='User Information Changed Successfully'; ?> <?PHP $_SESSION['data_action']='UPDATE';?> document.forms["useredit"].submit(); } } } On the submission form, I have the following: switch ($_SESSION['data_action']) { case "INSERT": $query = "INSERT INTO userlist VALUES '$userid','$firstname','$lastname',$usertype,'$pw','$email','2025-12-31')"; break; case "UPDATE": // if the password reset button is checked, then reset user's password if (isset($_POST['fld_resetpassword'])) { $query = "UPDATE userlist SET firstname = '$firstname', lastname = '$lastname', usertype = '$usertype', pw = '$pw', email = '$email' WHERE userid = '$userid'"; } else { // otherwise don't change the password $query = "UPDATE userlist SET firstname = '$firstname', lastname = '$lastname', usertype = '$usertype', email = '$email' userid = '$userid'"; } break; case "DELETE": $query = "DELETE FROM userlist WHERE userid = '$userid'"; break; } INSERT works fine. UPDATE works fine. DELETE displays the message "ALERT: DEBUG Delete Confirmed" but then, on the PHP page, the output is: DEBUG: ----------> Data action ------------> UPDATE DEBUG: ----------> QUERY ------------> UPDATE userlist SET firstname = '... etc. etc. The code is definitely recognizing that it's a delete because the DELETE alert is being triggered, but why isn't the "<?PHP $_SESSION['data_action']='DELETE'; ?>" setting being honored and instead being seen/set as "UPDATE"? Thanks
×
×
  • 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.