0

Hi

I have some code where the user inputs some stuff and then i would like it to get added to a database. The problem is dont know how to make it so that it only adds to the database when the user has submited it?

Any ideas ?

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by Newbie 123
0

Hi newbie 123 and welcome to daniweb

All you need to do is use $_POST to test if the form has been set in the URL.

This would be your form:

<form action='?send=true' method='POST'>
<input type='text' name='whatever'>
</form>

When this form is clicked the user is sent to the same page but

?send=true

is echoed in the URL.

You can then test if it is set by doing the following:

if (isset ($_POST['send'])) {
// SEND OF TO DATABASE
}

Hope all this helps
And if you need any help just post :)

0

That works great thankyou !!!!
Daniweb seems great and it was such a fast reply :O

Thankyou thankyou thankyou !!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.