Hi Chaps,
I have a repeat region, displaying rows of data: jobid, fromtable, translatorcharge
In each row there is an input field to enter a cost for each job 'charge'.
//INPUT - TRANSLATOR CHARGE
Code: (text) <input type="text" name="translatorcharge" id="count" class="price" value="<?php echo $row_rsInvPending['jobtranslatorcharge']; ?>"/>
I have a hidden input that collects the information for each row, before sending all the information to a script page:
//HIDDEN INPUT - INFO COLLECTOR
Code: (text) <?php
$table_name = $row_rsInvPending['fromtable'];
$item_id = $row_rsInvPending['jobid'];
?>
<input type="hidden" name="jobinvsent[]" value="<?php echo $table_name; ?>:<?php echo $item_id; ?>:<?php $_POST['translatorcharge'] ?>" />
The script page then updates the translatorcharge column in the relevant table:
//SCRIPT - TO UPDATE DATABASE
Code: (text) $allowed_tables = Array('tbl_jobs','tbl_jobtransline','tbl_jobxml'); // to prevent SQL injection
foreach($_POST['jobinvsent'] as $var) {
$arr = explode(':', $var);
if(in_array($arr[0], $allowed_tables)) {
$table = $arr[0];
$rowid = $arr[1];
$transcharge = $_POST['translatorcharge'];
if(is_numeric($rowid)) {
// run your SQL query here to update $table where row matches $rowid
$mess = $ref = $_SERVER['HTTP_REFERER']; header( 'refresh: 0; url='.$ref);
$query = sprintf("UPDATE $table SET jobtranslatorcharge='$transcharge' WHERE jobid=$rowid");
$result = mysql_query($query, $conndb2) or die(mysql_error());
}
else {
$mess = "<p>There was a problem</p>";
}
}
}
The problem is, although I'm entering different values for each row, only the last entered value is being passed to the array and therefore updating all rows with the same value.
My questions is, how can I 'individualise' each input, relating to each row?
Session is not saving
I am not trying to do anything too fancy, I am just trying to get some $_SESSION data to save and use it on the next page, but so far no luck. Its saving some data to $_SESSION['name'] and then
User information
Hi All,
Taylor Series Function
So I am working a a project for my intro C++ class, and I am having some trouble with a function for approximating exp(x) using a taylor series. The taylor series approximations for exp(x) is:
Time script, set to my time zone?
I am using this line to get the date and timeCode: $time = date(F." ".d.", ".Y." ".g.":".i.":".sa,time());How could I change this to my time zone here
Rand() help needed
Hi all,Can someone explain and give me a quick example of how I would go about this?I have 100 values in a database with colum headings of t_val and t_name. If I wanted to update all 100 of these
How to change www in url with a specified name
HiI'm trying to change the url http://www.sitename.com/apparels to something like belowhttp://apparels.sitename.com/apparels in PHP.If anybody can help me with the code for the same or provide links
Querying info from one table based on info in another
Hi, I am currently trying to make a part for my user driven website where one user can subscribe to another and whoever they have subscribed to is echoed back on there profile page. my users table
frames get header location..
i have two frames, one top, one bottom. how do i do a form on the bottom frame that gives me the url of the top frame.is it get header location?.. if so how do i use it to get the top frames url.is
Gantt Chart Tool
Does anyone know of a good free gantt chart creator toolThanks
Email Form Syntax Issue
I need the TO: in email to display To: CEO instead of To: abc@mail.comHow to alter the script below?Code: <?PHP$to = "abc@mail.com";$subject = "subject"; $headers =