Jump to content

missing parameter in sql from form


WAMFT1

Recommended Posts

Hi all
 
I know this is old code and it is in the process of being updated. In the meantime I need to get this simple code working. 
 
I cannot get the prospect_id to populate in the form or on sql. Can someone please help me shed some light on this.
 
<?php
require("../edb.php");
$prospect_id =$_REQUEST['prospect_id'];
$staff_id =$_SESSION['uid'];

$result = mysql_query("SELECT * FROM `eusers` WHERE id  = $staff_id");
$test = mysql_fetch_array($result);
if (!$result) 
		{
		die("Error: Data not found..");
		}
	$FirstName=$test['FirstName'];
	$LastName=$test['LastName'];
	$staff_id=$test['id'];

if(isset($_POST['submit'])){
			$staff_id = protect($_POST['staff_id']);
			$date = protect($_POST['date']);
			$prospect_id = protect($_POST['prospect_id']);
			$comment = protect($_POST['comment']);	

$res = mysql_query("INSERT INTO `DATABASE_Prospect_Notes` (`prospect_id`, `staff_id`, `comment`, `date`) VALUES ('".$prospect_id."', '".$staff_id."', '".$comment."', '".$date."')");
	echo "Saved!";
}
?>

 

Link to comment
Share on other sites

May have misread your question, the form is below

<form method="post">
		  <table width="600" border="0" align="center" >
		    <tr><td class="standard_left">Date:</td>
		      <td class="standard_left"><input name="date" type="text" id="date" value="<?php print(Date("d-m-Y H:i:s")); ?>" readonly></td>
	        </tr>
		    <tr><td width="141" class="standard_left">Added By:</td>
		      <td class="standard_left"><input name="staff_id" type="hidden" id="staff_id" value="<?php echo $staff_id?>"><?php echo $FirstName?> <?php echo $LastName?><input name="prospect_id" type="text" id="prospect_id" value="<?php echo $prospect_id?>" readonly></td>
	        </tr>
		    <tr><td valign="top" class="standard_left">File Note:</td>
		      <td><textarea name="comment" id="comment" cols="45" rows="5"></textarea></td>
	        </tr>
		    <tr><td class="text-questions"> </td>
		      <td class="text-questions"> </td>
	        </tr>
		    <tr><td colspan="2" class="text-send"><span class="text-questions" style="text-align: center"><input type="button" onClick="location.href='database_view_prospects.php'" value="Close"></span><input type="submit" name="submit" id="submit" value="Save Changes"></td>
	        </tr>
		    <tr><td> </td>
		      <td> </td>
	        </tr>
	      </table>
		</form>
Link to comment
Share on other sites

readonly input can not be modified

you are using it as a post field which it will always be empty unless you populated it when the form is made

 

If this value exists in database

$prospect_id=$test['prospect_id'];

<input name="prospect_id" type="text" id="prospect_id" value="<?php echo $prospect_id?>" readonly>

If the user is supposed to submit the prospect_id

<input name="prospect_id" type="text" id="prospect_id" value="<?php echo $prospect_id?>">
Link to comment
Share on other sites

add this in your index/header/config.php:

 

if ($_REQUEST['e'] == "all")
{
echo "<br>Now reporting ALL errors/warnings!<br>";
error_reporting(E_ALL);
ini_set('display_errors', '1');
}

when something is not right.. append ?e=all to the adress bar :)

Link to comment
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.