/    Sign up×
Community /Pin to ProfileBookmark

How can i fix the code about the post

i got problems in php about when i add new records and save it then look in the database the record is saved but when i refresh the page then look again in the database the record is saved again, how can i fix this problem cus the data is duplicating?? pls reply asap

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@SheldonApr 27.2006 — try posting some code so where can help you fix it, or you can add a hidden reference withteh post that is adding, and run a check before you insert the entry to see if the DB already contains this post
Copy linkTweet thisAlerts:
@SheldonApr 27.2006 — like insert a session_id();
Copy linkTweet thisAlerts:
@silvermoonauthorApr 27.2006 — <?php

$A=mysql_connect('localhost', 'root', 'skraizen');

$B=mysql_select_db("basic_database");



if ($A){

echo"Server connected<br>";

} else{

echo"<font color= 'red'> Server not connected<br></font>";

}


if ($?{

echo"Database Connected<br>";

}

else{

echo"<font color= 'red'>Database not connected<br></font>";

}


echo "<br>

<form method='get' action='add.php'>

Enter name &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type= text name='name'><br>

Enter age &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; <input type= text name='age'><br>

Enter country &nbsp;&nbsp;&nbsp;<input type= text name='country'><br>

Enter email &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type= text name='email'><br><br>

<input type=submit value='REgister USer'><br>

</form>";





$adder="insert into personal_info values('','$name','$age','$country','$email')";

mysql_query($adder);




?>


here also i want to make a message like if the data really is isaved or if not then it will go back again to start
×

Success!

Help @silvermoon 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.25,
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,
)...