Jump to content

Recommended Posts

Not quit there yet.  Have a form that loads database information which could then be modified to update the database with the new information. The date changes fine, but the newcomments is not being past to the posthp.php.

 

ModifyHP.php

<?php
$dbh=mysql_connect ("xxxxxxxx", "xxxxxxxx_xxxxxxxx", "xxxxxxxx") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("xxxxxxxx_xxxxxxxx");

$query = "SELECT * FROM `homepage`";
$result = mysql_query($query,$dbh) or die(mysql_error());

while($row = mysql_fetch_array($result))
        {
          echo "<font size=+2>Modify Home Page</font>";
         echo "<form action=\"posthp.php\">";
         echo "<textarea name=\"newcomments\" cols=\"100\" rows=\"40\">";
         echo $row['comments'];
         echo "</textarea>";
         echo "<br>";
         echo "<input type=\"submit\">";
         echo "</form>";
        }

?>

 

posthp.php

<?php
$newcomments = $_POST['newcomments'];
$date = date('ymd');

$dbh=mysql_connect ("xxxxxxxx", "xxxxxxxx_xxxxxxxx", "xxxxxxxx") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("xxxxxxxx_xxxxxxxx");

$sql = "UPDATE homepage SET date='$date', comments='$newcomments' WHERE rrn='1'";

$result = mysql_query($sql) or die('I cannot update database: "' . mysql_error());

echo "<center>Home Page Updated - <a href=\"index.php\"><font size=\"4\">BACK TO CONTROL PANEL</font></A></center>";
echo "";
?>

Link to comment
https://forums.phpfreaks.com/topic/65752-solved-variable-not-passing-through/
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.