0

first , I use the code below to show data such as name , quotation id and user id etc etc from table quotation that contains customer id , I wanted to update table quotation and update wpids value in table corders based on the value of wid in table quotation . Thank you in advance for those who are willing to help

updatequo.php

<?php 
$qid =$_GET["qid"];
$query = mysqli_query ($conn, "SELECT * FROM quotation where qid = '$qid';");
$result = mysqli_fetch_array($query);
?>
<form action='updatequo1.php?qid=<?php echo $qid;?>' method='post'>
<table align='center' width='45%' border='0' cellpadding='0' cellspacing='0'>

<tr>
  <td align='left' width='50%'>Quotation ID<td><input class='Minput'  type ='text' name='qid'value='<?php echo $result["qid"];?>' disabled ></td>
</tr>
<tr>
  <td align='left' width='30%'>User ID<td><input class='Minput'  type ='text' name='uid' value='<?php echo $result["uid"];?>' disabled ></td>
</tr>

but when i declare $uid = $_POST['uid']; in updatequo1.php but it says

Notice: Undefined index: uid

in updatequo1.php i wanted to update the value of wpids and change it based on wid value

 $result=mysqli_query ($conn, " UPDATE corders set wpids = '$wid' where customerid = '$uid';");
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
nh. m
  • 3
  • 6
  • 1
    You are open to SQL and XSS injections. Don't just trust user input. Don't use HTML tables for design, use CSS. What do the transmitted form fields end up sent as? – user3783243 Dec 09 '18 at 16:36
  • What does `var_dump($_POST);` say? – infinitezero Dec 09 '18 at 16:37
  • Editing the question is not how to mark it as resolved. Please post an answer, accept and answer (if one resoled your issue), or delete the question if it was just a typo. – user3783243 Dec 09 '18 at 16:46

2 Answers2

0

Your input field is disabled please replace it with readonly. Disable field data can not be sent by post or get.

Rohit Rasela
  • 425
  • 3
  • 6
0

The reason for the undefined index is because you have the inputs disabled:

<input class='Minput'  type ='text' name='qid'value='<?php echo $result["qid"];?>' disabled >
<input class='Minput'  type ='text' name='uid' value='<?php echo $result["uid"];?>' disabled >

Change it from disabled to readonly.

Disabled inputs will not be sent to the back end on your POST request.

Sam
  • 2,856
  • 3
  • 18
  • 29