Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL
Author Message
ThePiston
Worker
Worker



Joined: Dec 22, 2004
Posts: 135

PostPosted: Mon Oct 10, 2005 3:10 pm Reply with quote

I have this code setup inside "edithome".
Code:
   {

   print "<table width=100% border=1>";
   echo "<tr><b><h4>Use the form below to add additional offices.</b></h4>"
   ."<form name=\"Office\" action=\"modules.php?name=$module_name\" method=\"post\">"
   ."<br><td><font color=AE4355><b>Step 1, please check where this office is located.</b></font><br><br>"
   ."<input type=\"radio\" name=\"locationid\" value=\"1\" $sel1> "._FW."<br>"
   ."<input type=\"radio\" name=\"locationid\" value=\"2\" $sel1> "._NW." <br>"
   ."<input type=\"radio\" name=\"locationid\" value=\"3\" $sel1> "._N." <br>"
   ."<input type=\"radio\" name=\"locationid\" value=\"4\" $sel1> "._S." <br>"
   ."<input type=\"radio\" name=\"locationid\" value=\"5\" $sel1> "._E." <br>"
   ."<input type=\"radio\" name=\"locationid\" value=\"6\" $sel1> "._CH." <br>"
   ."<input type=\"radio\" name=\"locationid\" value=\"7\" $sel1> "._ML." <br>"
   ."<input type=\"radio\" name=\"locationid\" value=\"8\" $sel1> "._RF." <br><br></td>";
   echo "<td><font color=AE4355><b>Step 2, please change info below to alter or add an additional office location where you can be found by the public.</b></font><br><br>"
      ."<b>"._PRONAME."</b>: <b>".$userinfo['name']."</b><br>"
      ."<b>"._PRACTNAME.":</b><input type=\"text\" name=\"practname\" value=\"\" size=\"50\" maxlength=\"100\"><br>"
      ."<b>"._ADDRESS1.":</b><input type=\"text\" name=\"add1\" value=\"\" size=\"30\" maxlength=\"100\"><br>"
      ."<b>"._ADDRESS2.":</b><input type=\"text\" name=\"add2\" value=\"\" size=\"30\" maxlength=\"100\"><br>"
      ."<b>"._CITY.":</b><input type=\"text\" name=\"city\" value=\"\" size=\"30\" maxlength=\"50\"><br>"
      ."<b>"._STATE.":</b><input type=\"text\" name=\"state\" value=\"VA\" size=\"2\" maxlength=\"2\"><br>"
      ."<b>"._ZIP.":</b><input type=\"text\" name=\"zip\" value=\"\" size=\"13\" maxlength=\"13\"><br>"
      ."<b>"._PHONE.":</b><input type=\"text\" name=\"phone\" value=\"(804) \" size=\"14\" maxlength=\"14\"><br>"
      ."<b>"._FAX.":</b><input type=\"text\" name=\"fax\" value=\"(804) \" size=\"14\" maxlength=\"14\"><br>"
      ."<b>"._WEBSITE.":</b><input type=\"text\" name=\"website\" value=\"http://www.\" size=\"50\" maxlength=\"100\"><br>";
   echo "<td><font color=AE4355><b>Step 3, click 'Add Office' to save this office into the ROS database.</b></font><br><br>"
      ."<input type=\"hidden\" name=\"oid\" value=\"".intval($userinfo['oid'])."\">"
       ."<input type=\"hidden\" name=\"op\" value=\"saveoffice\">"
       ."<input class=button type=\"submit\" value=\""._SAVECHANGES."\">"
       ."</form></td></tr>"
      ;

    }
in the code above people can shoose an area, then input the address of the office and then it will save the data (and update "oid" to next number in DB (int11 is 'type')
I'm trying to use this form to update the info in it into multiple tables
Code:
function saveoffice($user_id, $username, $storynum, $ublockon, $ublock, $broadcast, $oid, $locationid, $practname, $add1, $add2, $city, $state, $zip, $phone, $fax, $website) {

    global $user, $cookie, $userinfo, $user_prefix, $db, $module_name;
    cookiedecode($user);
    $check = $cookie[1];
    $check2 = $cookie[2];
    $sql = "SELECT user_id, user_password FROM ".$user_prefix."_users WHERE username='$check'";
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $vuid = intval($row['user_id']);
    $ccpass = $row['user_password'];
    if (($user_id == $vuid) AND ($check2 == $ccpass)) {
   if(isset($ublockon)) $ublockon=1; else $ublockon=0;
   $ublock = FixQuotes($ublock);
   $db->sql_query("UPDATE offices and SET oid='$oid', locationid='$location_id', practname='$practname', add1='$add1', add2='$add2', city='$city', state='$state', zip='$zip', phone='$phone', fax='$fax', website='$website', WHERE user_id='$user_id'");
   getusrinfo($user);
   docookie($userinfo['user_id'],$userinfo['username'],$userinfo['user_password'],$userinfo['storynum'],$userinfo['umode'],$userinfo['uorder'],$userinfo['thold'],$userinfo['noscore'],$userinfo['ublockon'],$userinfo['theme'],$userinfo['commentmax']);
   Header("Location: modules.php?name=$module_name");
    }
}
doesn't seem to be working and I'm sure there are plenty of mistakes. Can someone point them out to me so I can fix them? TIA
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Mon Oct 10, 2005 9:48 pm Reply with quote

$db->sql_query("UPDATE offices and SET oid='$oid', locationid='$location_id', practname='$practname', add1='$add1', add2='$add2', city='$city', state='$state', zip='$zip', phone='$phone', fax='$fax', website='$website', WHERE user_id='$user_id'");

Should be

$db->sql_query("UPDATE offices SET oid='$oid', locationid='$location_id', practname='$practname', add1='$add1', add2='$add2', city='$city', state='$state', zip='$zip', phone='$phone', fax='$fax', website='$website', WHERE user_id='$user_id'");
 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©