Jump to content

Adding data in to a user specific row


bullbreed

Recommended Posts

Hello PHP masters  :D

 

I have a page on my site called client info.php. This page shows information specific to one of my clients.

I have a table in the db called trainingdata that holds the following info

 

id-------description-------date-------username------dateactioned-------action

 

The id, description, date  and username have data  that was collected when the user completed a form.

 

dateactioned and action are empty columns

 

I would like to be able to add data to the these empty ones by filling in a form on my page but it has to fill in the empty columns and not add a new row to the table because the info is associated with that user and that particular row of info as it will be displayed on the same page in the same html table. I cant do it

 

Here is what I tried

<?php
$submit = $_POST['submit'];

//Form data
$action = addslashes(strip_tags($_POST['action']));
$dateactioned = date("d-m-Y");

if ($submit){

//Check for existing fields
if ($action){
        
	//Register the user
	$queryreg = mysql_query("
  INSERT INTO " . TBL_TRAININGDATA . " (`action`, `dateactioned`) VALUES ('$action', '$dateactioned')");
	echo("<td><font size=\"2\" color=\"#0066FF\">Your training request has been sent successfully. <br />
	We will be in touch with more details.</font><td>");
}else{
	echo "<td><font size=\"2\" color=\"#ff0000\">Please complete <b>ALL</b> fields</font><td>";
	 }

}
?>

Obviously this code doesn't add it to the users row. It adds a new row to the database.It also doesn't make it relevant to that user.

I hope I have explained it well enough. 

Thanks

 

 

 

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.