Jump to content

mjgdunne

Members
  • Posts

    87
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mjgdunne's Achievements

Member

Member (2/5)

0

Reputation

  1. ok that worked. Thanks for your replys.
  2. Hi i have added the following: echo '<form action="save.php?pid='.$row['pid'].'" method="post"> <textarea name="mynotes"></textarea> </form>'; I am new to php and my knowledge is very basic, so any help would be great.
  3. Hi thanks for your reply, this is the search results with the textarea code: <?php session_start(); if($_SESSION['loggedin'] != "true") { header("Location: main_login.html"); } else { ?> <html> <head> <title>Car Rentals & Returns</title> <meta http-equiv="Content-Type" content="text/html" /> <link href="style2.css" rel="stylesheet" type="text/css" /> <SCRIPT LANGUAGE="JavaScript"> document.write(Date()); </SCRIPT> </head> <body> <div id="wrapper3"> <img src="images/cars.jpg" width="996" height="100"></a> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <td align="center"> <H1>View Cases:</H1> </td> </table> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <TD ALIGN=CENTER> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="test"; // Database name $tbl_name="reff"; // Table name // Connect to server and select databse. mysql_connect("$host", "root", "root")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $pid = $_GET['pid']; $sql = "SELECT * FROM reff WHERE `pid` = '$pid'"; $result = mysql_query($sql) or die(mysql-error()); $row = mysql_fetch_assoc($result); echo "<table border=\"1\" align=\"center\">"; echo "<tr><th>ID</th>"; echo "<td>"; echo $row['pid']; echo "</td>"; echo "<tr><th>Make</th>"; echo "<td>"; echo $row['make']; echo "</td>"; echo "<tr><th>Model</th>"; echo "<td>"; echo $row['model']; echo "</td>"; echo "<tr><th>Registration</th>"; echo "<td>"; echo $row['registration']; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image2']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image3']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image4']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Damage Report</th>"; echo "<td>"; echo "<a href='upload/".$row['report']."' target='_blank'>Click Here to view damage report</a>"; echo "</td>"; echo "<tr><th>Notes on Case</th>"; echo "<td>"; echo '<textarea name="mynotes"></textarea>'; echo "</td>"; echo '<form action="save.php?pid='.$row['pid'].'" method="post">'; echo "<tr><th></th>"; echo "<td>"; echo "<button onclick=\"window.location.href='save.php?pid=".$row['pid']."'\">Save</button>"; echo "</td>"; ?> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=30%> <tr> </td> <form method="post" action="login_success2.php"> <td align="center"> <input type="submit" value="Home"/></form> </tr> </table> </table> </td> </tr> </table> </BODY> </HTML> <?php } ?> Here is my code for saving to the database: <?php session_start(); if($_SESSION['loggedin'] != "true") { header("Location: main_login.html"); } else { ?> <html> <head> <title>Car Rentals & Returns</title> <meta http-equiv="Content-Type" content="text/html" /> <link href="style2.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper3"> <img src="images/cars.jpg" width="996" height="100"></a> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <td align="center"> <H1>Notes Added</H1> <form action="login_success2.php" method="post"> </td> </table> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <TD ALIGN=CENTER VALIGN=TOP WIDTH=50> </TD> <TD ALIGN=LEFT VALIGN=TOP WIDTH=83%> </table> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="test"; // Database name $tbl_name="reff"; // Table name // Connect to server and select databse. mysql_connect("$host", "root", "root")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $pid = $_GET['pid']; $mynotes=$_POST['mynotes']; mysql_select_db("test"); $sql = "UPDATE reff SET notes = '" . $_POST['mynotes'] . "'WHERE `pid` ='$pid'"; mysql_query($sql) or die(mysql_error()); echo '<br />Query was:'.$sql; echo 'Notes are:'.$mynotes; ?> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <td align="center"><input type="submit" value="Home"/></td> </tr> </table> </table> </td> </tr> </table> </BODY> </HTML> <?php } ?>
  4. Hi i have the picture id part working when i do an echo on the query - i get the following. So it seems the notes are not being passed, any ideas would be great.
  5. Hi everyone, I have a php page which displays information and images, on this page i have added a textarea so that the user can add notes, my problem is, is that the notes are not being uploaded into the database. Here is the code for displaying, and the textarea: <?php session_start(); if($_SESSION['loggedin'] != "true") { header("Location: main_login.html"); } else { ?> <html> <head> <title>Car Rentals & Returns</title> <meta http-equiv="Content-Type" content="text/html" /> <link href="style2.css" rel="stylesheet" type="text/css" /> <SCRIPT LANGUAGE="JavaScript"> document.write(Date()); </SCRIPT> </head> <body> <div id="wrapper3"> <img src="images/cars.jpg" width="996" height="100"></a> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <td align="center"> <H1>View Cases:</H1> </td> </table> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <TD ALIGN=CENTER> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="test"; // Database name $tbl_name="reff"; // Table name // Connect to server and select databse. mysql_connect("$host", "root", "root")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $pid = $_GET['pid']; $sql = "SELECT * FROM reff WHERE `pid` = '$pid'"; $result = mysql_query($sql) or die(mysql-error()); $row = mysql_fetch_assoc($result); echo "<table border=\"1\" align=\"center\">"; echo "<tr><th>ID</th>"; echo "<td>"; echo $row['pid']; echo "</td>"; echo "<tr><th>Make</th>"; echo "<td>"; echo $row['make']; echo "</td>"; echo "<tr><th>Model</th>"; echo "<td>"; echo $row['model']; echo "</td>"; echo "<tr><th>Registration</th>"; echo "<td>"; echo $row['registration']; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image2']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image3']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image4']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Damage Report</th>"; echo "<td>"; echo "<a href='upload/".$row['report']."' target='_blank'>Click Here to view damage report</a>"; echo "</td>"; echo "<tr><th>Notes on Case</th>"; echo "<td>"; echo '<textarea name="mynotes"></textarea>'; echo "</td>"; echo '<form action="save.php?pid='.$row['pid'].'" method="post">'; echo "<tr><th></th>"; echo "<td>"; echo "<button onclick=\"window.location.href='save.php?pid=".$row['pid']."'\">Save</button>"; echo "</td>"; ?> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=30%> <tr> </td> <form method="post" action="login_success2.php"> <td align="center"> <input type="submit" value="Home"/></form> </tr> </table> </table> </td> </tr> </table> </BODY> </HTML> <?php } ?>[code] Here is my code for saving the information to the database: [code]<?php session_start(); if($_SESSION['loggedin'] != "true") { header("Location: main_login.html"); } else { ?> <html> <head> <title>Car Rentals & Returns</title> <meta http-equiv="Content-Type" content="text/html" /> <link href="style2.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper3"> <img src="images/cars.jpg" width="996" height="100"></a> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <td align="center"> <H1>Notes Added</H1> <form action="login_success2.php" method="post"> </td> </table> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <TD ALIGN=CENTER VALIGN=TOP WIDTH=50> </TD> <TD ALIGN=LEFT VALIGN=TOP WIDTH=83%> </table> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="test"; // Database name $tbl_name="reff"; // Table name // Connect to server and select databse. mysql_connect("$host", "root", "root")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $pid = $_GET['pid']; $mynotes=$_POST['mynotes']; mysql_select_db("test"); $sql = "UPDATE reff SET notes = '" . $_POST['mynotes'] . "'WHERE `pid` ='$pid'"; mysql_query($sql) or die(mysql_error()); echo '<br />Query was:'.$sql; echo 'Notes are:'.$mynotes; ?> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <td align="center"><input type="submit" value="Home"/></td> </tr> </table> </table> </td> </tr> </table> </BODY> </HTML> <?php } ?> [/code][/code]
  6. Hi i have tried this but it is not working here is my full code: <?php session_start(); if($_SESSION['loggedin'] != "true") { header("Location: main_login.html"); } else { ?> <html> <head> <title>Car Rentals & Returns</title> <meta http-equiv="Content-Type" content="text/html" /> <link href="style2.css" rel="stylesheet" type="text/css" /> <SCRIPT LANGUAGE="JavaScript"> document.write(Date()); </SCRIPT> </head> <body> <div id="wrapper3"> <img src="images/cars.jpg" width="996" height="100"></a> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <td align="center"> <H1>View Cases:</H1> </td> </table> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <TD ALIGN=CENTER> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="test"; // Database name $tbl_name="reff"; // Table name // Connect to server and select databse. mysql_connect("$host", "root", "root")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $pid = $_GET['pid']; $sql = "SELECT * FROM reff WHERE `pid` = '$pid'"; $result = mysql_query($sql) or die(mysql-error()); $row = mysql_fetch_assoc($result); echo "<table border=\"1\" align=\"center\">"; echo "<tr><th>ID</th>"; echo "<td>"; echo $row['pid']; echo "</td>"; echo "<tr><th>Make</th>"; echo "<td>"; echo $row['make']; echo "</td>"; echo "<tr><th>Model</th>"; echo "<td>"; echo $row['model']; echo "</td>"; echo "<tr><th>Registration</th>"; echo "<td>"; echo $row['registration']; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image2']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image3']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image4']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Damage Report</th>"; echo "<td>"; echo "<a href='upload/".$row['report']."' target='_blank'>Click Here to view damage report</a>"; echo "</td>"; echo "<tr><th>Notes on Case</th>"; echo "<td>"; echo '<form action="save.php?pid='.$row['pid'].'" method="post"> <textarea name="mynotes"></textarea> </form>'; echo "</td>"; echo "<tr><th></th>"; echo "<td>"; echo "<button onclick=\"window.location.href='save.php'\">Save</button>"; echo "</td>"; ?> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=30%> <tr> </td> <form method="post" action="login_success2.php"> <td align="center"> <input type="submit" value="Home"/></form> </tr> </table> </table> </td> </tr> </table> </BODY> </HTML> <?php } ?> <?php session_start(); if($_SESSION['loggedin'] != "true") { header("Location: main_login.html"); } else { ?> <html> <head> <title>Car Rentals & Returns</title> <meta http-equiv="Content-Type" content="text/html" /> <link href="style2.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="wrapper3"> <img src="images/cars.jpg" width="996" height="100"></a> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <td align="center"> <H1>Notes Added</H1> <form action="login_success2.php" method="post"> </td> </table> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <TD ALIGN=CENTER VALIGN=TOP WIDTH=50> </TD> <TD ALIGN=LEFT VALIGN=TOP WIDTH=83%> </table> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password="root"; // Mysql password $db_name="test"; // Database name $tbl_name="reff"; // Table name // Connect to server and select databse. mysql_connect("$host", "root", "root")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $pid = $_GET['pid']; $mynotes=$_POST['mynotes']; mysql_select_db("test"); $sql = "UPDATE reff SET notes = '" . $_POST['mynotes'] . "'WHERE `pid` ='$pid'"; mysql_query($sql) or die(mysql_error()); echo '<br />Query was:'.$sql; echo 'Notes are:'.$mynotes; ?> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=100%> <tr> <td align="center"><input type="submit" value="Home"/></td> </tr> </table> </table> </td> </tr> </table> </BODY> </HTML> <?php } ?>
  7. Hi thanks for your reply do you mean something like this: echo "<tr><th>Notes on Case</th>"; echo "<td>"; echo '<form action="save.php?pid='.$row['pid'].'" method="post"> <textarea name="mynotes"></textarea> </form>'; echo "</td>"; echo "<tr><th></th>"; echo "<td>"; echo "<button onclick=\"window.location.href='save.php'\">Save</button>"; echo "</td>"; ?>
  8. The text contained in 'mynotes' does not seem to be getting passed through $pid = $_GET['pid']; $mynotes=$_POST['mynotes']; mysql_select_db("test"); $sql = "UPDATE reff SET notes = '" . $_POST['mynotes'] . "'WHERE `pid` ='$pid'"; mysql_query($sql) or die(mysql_error()); echo '<br />Query was:'.$sql; echo 'Notes are:'.$mynotes;
  9. Hi i am having a problem, i am trying to update a field in my database with info from a textarea 'mynotes', the field in the database is called notes. Here is my code where i am displaying results and printing a text area for the user to add notes: $pid = $_GET['pid']; $sql = "SELECT * FROM reff WHERE `pid` = '$pid'"; $result = mysql_query($sql) or die(mysql-error()); $row = mysql_fetch_assoc($result); echo "<table border=\"1\" align=\"center\">"; echo "<tr><th>ID</th>"; echo "<td>"; echo $row['pid']; echo "</td>"; echo "<tr><th>Make</th>"; echo "<td>"; echo $row['make']; echo "</td>"; echo "<tr><th>Model</th>"; echo "<td>"; echo $row['model']; echo "</td>"; echo "<tr><th>Registration</th>"; echo "<td>"; echo $row['registration']; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image2']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image3']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image4']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Damage Report</th>"; echo "<td>"; echo "<a href='upload/".$row['report']."' target='_blank'>Click Here to view damage report</a>"; echo "</td>"; echo "<tr><th>Notes on Caes</th>"; echo "<td>"; echo "<textarea cols=80 rows=10 name=mynotes></textarea>"; echo "</td>"; echo "<tr><th></th>"; echo "<td>"; echo "<button onclick=\"window.location.href='save.php?pid=".$row['pid']."'\">Save</button>"; echo "</td>"; ?> Here is my code for updating: $pid = $_GET['pid']; $mynotes=$_GET['mynotes']; $sql = "UPDATE reff SET notes = '" . $_POST['mynotes'] . "'WHERE `pid` ='$pid'"; mysql_query($sql) or die(mysql_error()); echo '<br />Query was:'.$sql; ?>
  10. Do you think i could use: <form method="post" action="save.php?pid=".$row['pid']."'\">
  11. Sorry i cut off the end bit: <tr> <TD ALIGN=RIGHT>Notes on Case:</td> <TD ALIGN=LEFT><textarea rows="10" name="mynotes" cols="30"></textarea> </tr> <TABLE BGCOLOR="#F0F8FF" BORDER=0 CELLPADDING=10 WIDTH=30%> <tr><form method="post" action="login_success2.php"> <td align="center"> <input type="submit" value="Home"/></form> <form method="post" action="save.php"> <td align="center"><input type="submit" value="Save"/><form></td> </tr> </table> </table> </td> </tr> </table> </BODY> </HTML> <?php } ?>
  12. Hi ya it seems to be empty, Here is the code i am using on the page before, is there any way of sending the pid to the next page for use? mysql_connect("$host", "root", "root")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $pid = $_GET['pid']; $sql = "SELECT * FROM reff WHERE `pid` = '$pid'"; $result = mysql_query($sql) or die(mysql-error()); $row = mysql_fetch_assoc($result); echo "<table border=\"1\" align=\"center\">"; echo "<tr><th>ID</th>"; echo "<td>"; echo $row['pid']; echo "</td>"; echo "<tr><th>Make</th>"; echo "<td>"; echo $row['make']; echo "</td>"; echo "<tr><th>Model</th>"; echo "<td>"; echo $row['model']; echo "</td>"; echo "<tr><th>Registration</th>"; echo "<td>"; echo $row['registration']; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image2']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image3']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Image</th>"; echo "<td>"; echo "<img src='upload/".$row['image4']."' width='250' height='250'/>"; echo "</td>"; echo "<tr><th>Damage Report</th>"; echo "<td>"; echo "<a href='upload/".$row['report']."' target='_blank'>Click Here to view damage report</a>"; echo "</td>"; ?> <tr> <TD ALIGN=RIGHT>Notes on Case:</td> <TD ALIGN=LEFT><textarea rows="10" name="mynotes" cols="30"></textarea> </tr> I am taking the information from the textarea named mynotes.
  13. hi i am trying to update one field in the database.
  14. hi i added that line, still not putting the details into the database
  15. Hi thanks for your reply, i am trying, $pid = $_GET['pid']; $mynotes=$_POST['mynotes']; mysql_select_db("test"); mysql_query("UPDATE reff SET notes = '" . $_POST['mytitle'] . "'WHERE pid='" . $_POST['pid'] . "'"); But it doesnt seem to be working, any help would be great.
×
×
  • 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.