WAMFT1 Posted October 14, 2015 Share Posted October 14, 2015 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!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/298587-missing-parameter-in-sql-from-form/ Share on other sites More sharing options...
Ch0cu3r Posted October 14, 2015 Share Posted October 14, 2015 Can you post your form? Quote Link to comment https://forums.phpfreaks.com/topic/298587-missing-parameter-in-sql-from-form/#findComment-1523259 Share on other sites More sharing options...
WAMFT1 Posted October 14, 2015 Author Share Posted October 14, 2015 The form posts and all the information is captured except the prospect_id field but this does not show on the form either. Quote Link to comment https://forums.phpfreaks.com/topic/298587-missing-parameter-in-sql-from-form/#findComment-1523267 Share on other sites More sharing options...
WAMFT1 Posted October 14, 2015 Author Share Posted October 14, 2015 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> Quote Link to comment https://forums.phpfreaks.com/topic/298587-missing-parameter-in-sql-from-form/#findComment-1523268 Share on other sites More sharing options...
cyberRobot Posted October 14, 2015 Share Posted October 14, 2015 For your form, where is $prospect_id defined? Also, have you set PHP to display all errors and warnings? Note that you can add the following to the top of your script(s) during the debugging process: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> Quote Link to comment https://forums.phpfreaks.com/topic/298587-missing-parameter-in-sql-from-form/#findComment-1523270 Share on other sites More sharing options...
QuickOldCar Posted October 14, 2015 Share Posted October 14, 2015 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?>"> Quote Link to comment https://forums.phpfreaks.com/topic/298587-missing-parameter-in-sql-from-form/#findComment-1523272 Share on other sites More sharing options...
Tommie84 Posted October 14, 2015 Share Posted October 14, 2015 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 Quote Link to comment https://forums.phpfreaks.com/topic/298587-missing-parameter-in-sql-from-form/#findComment-1523302 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.