Jump to content

Pass variable and update database


austine_power007

Recommended Posts

I have a page named update_data.php the code:
[code]echo"
    <table width='548' height='255' border='0'>
<form name='exampleform' onsubmit='return formValidator()' method='POST' action='update_success.php'>
        <tr>
          <td width='159' align='right' valign='middle' class='style12'>Job Title:</td>
          <td colspan='3'><input name='job_ttl' type='text' id='job_ttl'value=\"{$titl}\" size='50' DISABLED></td>
          </tr>
        <tr>
          <td align='right' valign='middle' class='style12'>Start Date: </td>
          <td colspan='2'><label>
            <input name='start_dat' type='text' id='start_dat' value=\"{$start}\" DISABLED>
          </label></td>
          <td width='227'>&nbsp;</td>
          </tr>
        <tr>
          <td align='right' valign='middle' class='style12'>Est. End Date: </td>
          <td colspan='2'><label>
            <input name='est_dat' type='text' id='est_dat' value=\"{$end}\" DISABLED>
          </label></td>
          <td>&nbsp;</td>
          </tr>
        <tr>
          <td align='right' valign='middle' class='style12'>Actual End Date: </td>
          [b]<td colspan='2'><label>
            <input type=\"text\" name=\"act_dat\" value=\"{$actual[0]}$actual[1]\" size='01'><span class='style12'>dd</span><input type=\"text\" name=\"act_mon\" value=\"{$actual[3]}$actual[4]\" size='01'><span class='style12'>mm</span><input type=\"text\" name=\"act_yr\" value=\"{$actual[6]}$actual[7]\" size='01'><span class='style12'>yy</span>
          </label></td>[/b]
          <td>&nbsp;</td>
          </tr>
        <tr>
          [b]<td height='39' align='right' valign='middle' class='style12'>Completed:</td>
          <td colspan='3' bordercolor='#000000'><table width='300' border='0'>
              <tr>
                <td width='20'><input name='comp' type='text'  id='comp' value=\"{$complete}\" size='01'  ></td>[/b]
                <td width='270'><span class='style15'><span class='style17'><span class='style19'>%</span> <strong>( Integer</strong></span><span class='style22'> numbers Only)</span></span></td>

              </tr>
            </table></td>
          </tr>
        <tr>
          [b]<td height='46' align='right' valign='top' class='style12'>Remarks:</td>
          <td colspan='3' valign='top'><textarea name='remark' cols='50'  id='remark'>{$remark}</textarea></td>[/b]
          </tr>
       
        <tr>
          <td height='26' align='right' valign='middle' class='style10'>&nbsp;</td>
          <td width='66'><label>
          <input type='submit' name='Submit' value='Submit'>
          </label></td>
          <td width='78'><input type='reset' name='Submit2' value='Reset'></td>
          <td><label></label></td>
        </tr>
</form>
      </table> ";
  }[/code]

Ok in this code i retrive some data from database 
Now i when user click submit it goes to update_success.php page and the code of update is:

[code]<?php

include "connect_db.php";

if (isset($_GET['Submit'])) // name of submit button
{
$title=$_GET['job_ttl'];
echo "$title";
$act_date=$act_mon.'/'.$act_dat.'/'.$act_yr;
$complete=$_GET['comp'];
$remark=$_GET['remark'];

$query = odbc_exec($odbc, "UPDATE task act_end_date ='$act_date',complete = $complete,remark = '$remark'  WHERE title = '$title'") or die ("Wrong data");


function Redirect($time, $topage)
{

echo "<meta http-equiv=\"refresh\" content=\"{$time}; url={$topage}\" /> ";
}
Redirect(1, "profile.php");

exit;
}
?>[/code]
But it update nothing ....wht is happneing ?? help me with my college project :(

[b]E.G: i am using Microsoft Access 2003[/b]
Link to comment
Share on other sites

[quote author=thorpe link=topic=118958.msg487046#msg487046 date=1166412724]
Your missing the SET keyword in your query.

[code=php:0]
query = odbc_exec($odbc, "UPDATE task SET act_end_date ='$act_date',complete = $complete,remark = '$remark'  WHERE title = '$title'") or die ("Wrong data");
[/code]
[/quote]

I have tried with the SET also but it didn't update the table why?? is it getting data from other files??
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.