Hey All I'm back again and can't figure this out... k, so I have this script I'll post below it basically is linked from another page with grabbing the ID from the URL - when I first bring up this page I'm able to echo out the ID then within this (all code on same page) there is a form that actions itself so you would think the ID would still be here but when I try to run the INSERT $client_id it's empty and I'm getting this error when hitting the submit button for the new note to be added.
VAR no passing PHP
9
Hey All I'm back again and can't figure this out...
k, so I have this script I'll post below it basically is linked from another page with grabbing the ID from the URL - when I first bring up this page I'm able to echo out the ID then within this (all code on same page) there is a form that actions itself so you would think the ID would still be here but when I try to run the INSERT $client_id it's empty and I'm getting this error when hitting the submit button for the new note to be added.
DATEUSERMESSAGEACTIONSorry Mate Couldn't select datbaseYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
now the thing is if you see the source code this error is refering to the query that works fine for spitting out the messages prior to hitting the add new note.. also looking at code in the RED message I added the VAR's to see what was coming out and nothing here.. so I'm lost!
here the whole source
k, so I have this script I'll post below it basically is linked from another page with grabbing the ID from the URL - when I first bring up this page I'm able to echo out the ID then within this (all code on same page) there is a form that actions itself so you would think the ID would still be here but when I try to run the INSERT $client_id it's empty and I'm getting this error when hitting the submit button for the new note to be added.
DATEUSERMESSAGEACTIONSorry Mate Couldn't select datbaseYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
now the thing is if you see the source code this error is refering to the query that works fine for spitting out the messages prior to hitting the add new note.. also looking at code in the RED message I added the VAR's to see what was coming out and nothing here.. so I'm lost!
here the whole source
PHP Code:
<?php
include ("connect.php");
$id = $_GET['id'];
if (isset($_POST['submit'])) {
$message = $_POST['message'];
$date = date("F j, Y");
$client_id = $_GET['id'];
echo $id;
echo $client_id;
$insert = mysql_query("INSERT INTO `notes` VALUES ('$client_id','$date','$user','$message','')") or die (mysql_error());
if ($insert) {
echo "<div align='center'><font color='red'>Note Added Successfully Please Refresh" .$client_id . $id . "</font></div>";
}
}
//Client Notes - Should pull up notes related to client selected by ID
?>
<table align="center" border="1">
<tr>
<th>DATE</th>
<th>USER</th>
<th>MESSAGE</th>
<th>ACTION</th>
</tr>
<?php
$query = mysql_query("SELECT * FROM `notes` WHERE client_id=$id") or die("Sorry Mate Couldn't select datbase" . mysql_error());
while ($row=mysql_fetch_array($query)) {
$num_row = mysql_num_rows($query);
if ($num_row > 0) {
echo "<tr><td>" . $row['date'] . "</td><td>" . $row['user'] . "</td><td>" . $row['message'] . "</td><td><a href='markread.php'><div align='center'><img border='0' src='images/checkmark.gif' width='45' height='45'></a></div></td></tr>";
}
else {
echo "No Messages To Produce";
}
}
echo "</table>";
?>
<div align="center">
<form action="client_notes.php?client_id=<?php echo $id; ?>" method="POST">
<fieldset id="Add_Notes">
<legend>ADD NOTES</legend>
<label for="message">Message:</label>
<textarea cols="30" rows="5" name="message">
</textarea>
<input id="button1" type="submit" name="submit" value="ADD" />
</form>
</div> - CoursesWeb
- solidsoul
- phpg
- solidsoul
- solidsoul
- solidsoul
- Earnie Boyd
- phpg
Next Topics on Trending Feed
-
9