Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Aug 2006
    Posts
    131
    Member #
    13656
    PHP Code:
    <?php virtual('/professional/Connections/portfolio.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function 
    GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
    {
      
    $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 != "") ? "'" doubleval($theValue) . "'" "NULL";
          break;
        case 
    "date":
          
    $theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
          break;
        case 
    "defined":
          
    $theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
          break;
      }
      return 
    $theValue;
    }
    }

    $editFormAction $_SERVER['PHP_SELF'];
    if (isset(
    $_SERVER['QUERY_STRING'])) {
      
    $editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
    }

    if ((isset(
    $_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
      
    $updateSQL sprintf("UPDATE thoughts SET thought_date=%s, thought_title=%s, thought_text=%s WHERE thought_id=%s",
                           
    GetSQLValueString($_POST['thought_date'], "text"),
                           
    GetSQLValueString($_POST['thought_title'], "text"),
                           
    GetSQLValueString($_POST['thought_text'], "text"),
                           
    GetSQLValueString($_POST['thought_id'], "int"));

      
    mysql_select_db($database_portfolio$portfolio);
      
    $Result1 mysql_query($updateSQL$portfolio) or die(mysql_error());

      
    $updateGoTo "/professional/admin/success.php";
      if (isset(
    $_SERVER['QUERY_STRING'])) {
        
    $updateGoTo .= (strpos($updateGoTo'?')) ? "&" "?";
        
    $updateGoTo .= $_SERVER['QUERY_STRING'];
      }
      
    header(sprintf("Location: %s"$updateGoTo));
    }

    $colname_thoughts_info "-1";
    if (isset(
    $_GET['recordID'])) {
      
    $colname_thoughts_info = (get_magic_quotes_gpc()) ? $_GET['recordID'] : addslashes($_GET['recordID']);
    }
    mysql_select_db($database_portfolio$portfolio);
    $query_thoughts_info sprintf("SELECT * FROM thoughts WHERE thought_id = %s"GetSQLValueString($colname_thoughts_info"int"));
    $thoughts_info mysql_query($query_thoughts_info$portfolio) or die(mysql_error());
    $row_thoughts_info mysql_fetch_assoc($thoughts_info);
    $totalRows_thoughts_info mysql_num_rows($thoughts_info);
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    </head>

    <body>
    <form method="post" name="form1" action="<?php echo $editFormAction?>">
        <table align="center">
            <tr valign="baseline">
                <td nowrap align="right">Thought_id:</td>
                <td><?php echo $row_thoughts_info['thought_id']; ?></td>
            </tr>
            <tr valign="baseline">
                <td nowrap align="right">Thought_date:</td>
                <td>
                    <input type="text" name="thought_date" value="<?php echo $row_thoughts_info['thought_date']; ?>" size="32">
                </td>
            </tr>
            <tr valign="baseline">
                <td nowrap align="right">Thought_title:</td>
                <td>
                    <input type="text" name="thought_title" value="<?php echo $row_thoughts_info['thought_title']; ?>" size="32">
                </td>
            </tr>
            <tr valign="baseline">
                <td nowrap align="right">Thought_text:</td>
                <td>
                    <input type="text" name="thought_text" value="<?php echo $row_thoughts_info['thought_text']; ?>" size="32">
                </td>
            </tr>
            <tr valign="baseline">
                <td nowrap align="right">&nbsp;</td>
                <td>
                    <input type="submit" value="Update record">
                </td>
            </tr>
        </table>
        <input type="hidden" name="MM_update" value="form1">
        <input type="hidden" name="thought_id" value="<?php echo $row_thoughts_info['thought_id']; ?>">
    </form>
    <p>&nbsp;</p>
    </body>
    </html>
    <?php
    mysql_free_result
    ($thoughts_info);
    ?>
    For some reason this isn't redirecting to where I want it. It displays the selected record correctly and will actually update it, but won't redirect. I've noticed that it won't redirect to ANYWHERE. Maybe something wrong with the header command?

    Right now I'm using Apache 2.2.3 and PHP 5.2.0. Could it be something in the PHP.INI file that is preventing this from happening correctly? What could the problem be?
    Christopher Carvache
    Web Developer / SEO
    Northeast Web Design
    +1.860.906.7802

  2.  

  3. #2
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    exit; after the header.
    Shani

    I have an eye for detail like you'd never believe.

  4. #3
    Senior Member
    Join Date
    Aug 2006
    Posts
    131
    Member #
    13656
    Quote Originally Posted by DCScene
    exit; after the header.
    Nope. Tried that already. All it did was cause an error after hitting the submit button saying the connection was reset.
    Christopher Carvache
    Web Developer / SEO
    Northeast Web Design
    +1.860.906.7802

  5. #4
    Senior Member
    Join Date
    Aug 2006
    Posts
    131
    Member #
    13656
    Weirdness. I change the include from being a 'virtual' to a 'require_once' and it worked?????

    The weirdness of programming...
    Christopher Carvache
    Web Developer / SEO
    Northeast Web Design
    +1.860.906.7802


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:04 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com