/    Sign up×
Community /Pin to ProfileBookmark

form updating help

i’m making a CMS and i have a list of textbox’s, each containing a value from the DB. how can i set a unique name to each textbox and then know when to update it when it’s corresponding checkbox has been clicked?

so what it looks like is

[CODE]
<td><?=$rows[0] //class?></td> <td><?=$n?></td> <td><input type = “text” size = “1” name = “newdays<?=$rows[2] //emailid?>” value = “<?=$rows[1] //days?>” name = “days”/></td> <td><input type = “checkbox” name = “emailid[]” value = “<?=$rows[2]?>”></td> <td><?=$rows[2]?></td>
[/CODE]

so each text bos has the name newdaysXX, XX being a unique ID from the DB. the problem is i can’t reference it later on, what i was trying to do when updating it in the for loop was:

[CODE]$query = “UPDATE email_content SET days = [B]$_POST[newdays”.$days_emailid[$i].”][/B] WHERE class = ‘$_GET[class]’ and emailid = $days_emailid[$i]”;[/CODE]

(the reason there’s a $days_ prefix is because i used import_request_variables(“gp”, “days_“);

but whenever i try using the query i mentioned, i get the error Parse error: syntax error, unexpected ‘”‘, expecting ‘]’ in /home/admin/changestage.php on line 22

any suggestions?

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@chestertbNov 01.2007 — I think your problem is a couple of missing quote marks.

Try
[code=php]$query = "UPDATE email_content
SET days = $_POST[newdays".$days_emailid[$i]."]
WHERE class = '".$_GET['class']."' and emailid = $days_emailid[$i]";[/code]


CTB
×

Success!

Help @ixxalnxxi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...