Jump to content

[SOLVED] why won’t it post these values?


bradkenyon

Recommended Posts

I am having trouble grabbing the values from the form once processed. I need your help.

function updateUser($table, $id) {
    if($_POST) {
        processUpdate($table, $id);
    } else {
        updateForm($table, $id);
    }
}

function processUpdate($table, $id) {

    print $table; //testing
    print $id; //testing

    $email=addslashes($HTTP_POST_VARS['email']);
    $lname=addslashes($HTTP_POST_VARS['lname']);
    $fname=addslashes($HTTP_POST_VARS['fname']);

    print $lname;

    //which table do we update
    switch($table) {
        case "maillist":
                $result = mysql_query("UPDATE $table SET email='$email', lname='$lname', fname='$fname' WHERE id='$id'") 
                or die(mysql_error());
        break;
    }
}

 

The function updateForm($table, $id); just outputs the form, has email, lname, fname fields. And when you process the form, the action is the same, w/ the table and id being passed thru the url, so it GET's the id and table that way, and for lname, fname, and email, it should grab it via post.

 

But for some reason, it does not post the values.

 

 

 

Link to comment
Share on other sites

use a form value

 

example

 

<?php

if($_POST['submit']){

    $email=mysql_real_escape_string($_POST['email']);
    $lname=mysql_real_esacpe_string($_POST['lname']);
    $fname=mysql_real_escape_string($_POST['fname']);

switch($table) {
        case "maillist":
                $result = mysql_query("UPDATE $table SET email='$email', lname='$lname', fname='$fname' WHERE id='$id'")
                or die(mysql_error());
        break;
    }
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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