/    Sign up×
Community /Pin to ProfileBookmark

Form post data into a database everytime the page loads problem

Hello all this is my first post and im a bit of a n00b when it comes to hardcore web programming, however I thought that something like this should be easy.
The problem is that I have a form which is a preview page from another form, it allows the user to check to see if this is what they want to enter, however in previewing it, it automatically adds the data into the database, heres the main bit of code, I hope you can help me out, yours Al

[QUOTE]

<td align=”center”>Do Wish To Insert This Data?</td>
</tr>
<tr>
<td align=”center”>
<!–Create The Form–>
<input type=”submit” value=”No, Let Me Change It” onClick=”history.back()”>
<form name=”form1″ action=”addsuccess.php”>
<input type=”submit” name=”Submit” value=”Yes, Add The CD To The Database” onClick=””>
<?php
mysql_select_db(“db5”);
$sql=”INSERT INTO CD (CDTitle, CDSinger, CDGenre, CDPrice, CDBuy, CDimg, CDDescription) VALUES (‘$_POST[CDTitle]’, ‘$_POST[CDSinger]’, ‘$_POST[CDGenre]’, ‘$_POST[CDPrice]’, ‘$_POST[CDBuy]’, ‘$_POST[CDimg]’, ‘$_POST[CDDescription]’)”;
mysql_query($sql); ?>
</form></td>

[/QUOTE][code=php]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@dotancohenOct 13.2006 — So, what's the question?
×

Success!

Help @severedspirit 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.8,
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,
)...