小编Joe*_*ook的帖子

如何在不更新Dreamweaver中的数据库的情况下将PHP表单数据保存到会话变量?

我正在使用Dreamweaver构建我的PHP/MySQL站点,因为我的技能相当小,我想将选项从多选项下拉列表保存到$_SESSION变量.我在前一页上使用以下内容更新数据库中的字段时成功设法保存到会话变量并且似乎正在工作(Dreamweaver插入的页面顶部,我评论了我编辑它以使其存储到的位置的$_SESSION):

<?php
if (!function_exists("GetSQLValueString")) {
  function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
  {
    if (PHP_VERSION < 6) {
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    }

    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

    switch ($theType) {
      case "text":
        $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
        break;    
      case "long":
      case "int":
        $theValue = ($theValue != "") ? intval($theValue) : "NULL";
        break;
      case "double":
        $theValue = ($theValue != "") ? …
Run Code Online (Sandbox Code Playgroud)

php mysql forms session post

0
推荐指数
1
解决办法
629
查看次数

标签 统计

forms ×1

mysql ×1

php ×1

post ×1

session ×1