-
Updated a record
Thanks for your help everyone...
Right now, i have it where on one page, you click the ID, and it takes you to an "Update" Page.
I wanted it to take the ID that was clicked on the other page, and pass it into the db query script, and bring back its values, i have that done.
My problem is, i wanted it to put the queryed values into text box's so that the user can edit them, and then hit "update" and it will update that record in the DB.
I cant seem to get the values from my query into text box's
PHP Code:
<?php $pasc_id = $_REQUEST['pasc_id'] ?>
<?
$request = "SELECT DISTINCT pasc_id,part_number,return_po,date_entered,part_notes FROM dss_returns where pasc_id = '$pasc_id'";
$query = mysql_query($request);
$num = mysql_num_rows($query);
while($data = mysql_fetch_array($query)){
echo '<td><a href="./Update_Part.php?pasc_id=' . $data['pasc_id'] . '">' .' ' . $data['pasc_id'] . '</a>'. '</td>'.'<td>'. $data['part_number'] .'</td>'.'<td>'. $data['return_po']. '</td>' .'<td>'. $data['date_entered']. '</td>' . '<td>' . $data['part_notes'] . '</td></tr>';
echo '<td><a href="./Update_Part.php?pasc_id=' . $data['pasc_id'] . '">' .' ' . $data['pasc_id'] . '</a>'. '</td>';
echo '<form action="Update_Part.php" method="post">';
echo '<input type="text" name="partnumber" size="20" maxlenght="20" value=".<?php $data['part_number'] ?>."/>';
}
?>
-
Re: Updated a record
Change this
PHP Code:
value=".<?php $data['part_number'] ?>
To this
PHP Code:
value=".<?php echo $data['part_number'] ?>
-
Re: Updated a record
it says i have an unexspected t variable error
PHP Code:
echo '<input type="text" name="partnumber" size="20" maxlenght="20" value=".<?php echo $data['part_number'] ?>."/>';
-
Re: Updated a record
my bad, I did not see the original echo in the line
it needs to be
PHP Code:
echo '<input type="text" name="partnumber" size="20" maxlenght="20" value=". $data['part_number'] ."/>';
You don't need the <?php ?> around the $data['part_number']
-
Re: Updated a record
dohhh still an error:
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in C:\Inetpub\jf1\a\php\Update_Part.php on line 35
-
Re: Updated a record
you need to "end" the single quote before you can put your variable.
this is a really simple mistake.. are you even reading the code you're putting in joefox?
PHP Code:
echo '<input type="text" name="partnumber" size="20" maxlenght="20" value="'. $data['part_number'] .'"/>';
-
Re: Updated a record
yup, I was just copying and pasting his line, should have looked a little closer.