/    Sign up×
Community /Pin to ProfileBookmark

How can I process a form to maintain a database?

I’m fairly new to this, I have all the ideas but no code-experience php-wise to implement it.

I have a form that is submitting values to a posted page (save.html for example)

submits values such as

boxid|whatisinsidebox;boxid|whatisinsidebox;

etc.

How can I use php (which is enabled on the web server, works) to process these values and re-display them so as to keep this up to date whenever someone logs onto the page.

They are div containers with drag and drop functionality, from this site:
(Working Demo)

[url]http://www.dhtmlgoodies.com/scripts/drag-drop-nodes/drag-drop-nodes.html[/url]

I’d love to be able to bring up my version of that page, and have it MAINTAIN the altered values. So if I drop Student C to box C it will be there next time I visit the page.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@katierosyJun 10.2010 — Please see these lines of code, hope this may help

mysql_connect('localhost','root','');

mysql_select_db('boxdb');

$str = "boxid|whatisinsidebox;boxid|whatisinsidebox";

$ex1 = explode(";",$str);

foreach($ex1 as $ex2){

$exfin = explode("|",$ex2);

$insert_sql = "insert into boxtable(boxid,whatisinsidebox) values($exfin[0],$exfin[1])";

mysql_query($insert_sql);

}

// to select

$rs=mysql_query('select * from boxtable');

while($frow=mysql_fetch_assoc($rs)){

$row[] = $frow;

}

foreach($row as $temp){

print $temp['boxid'].'--'.$temp['whatisinsidebox'];

}

you may use forloop too

for($i=0;$i<count($row);$i++){

print $row[$i]['boxid'].'--'.$row[$i]['whatisinsidebox'];

}
×

Success!

Help @Sodascript 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.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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