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.

 

 

 

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;
    }
}

?>

Archived

This topic is now archived and is closed to further replies.

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