Jump to content

Insert value into mysql after confirmation


IreneLing

Recommended Posts

Hi all , sorry for posting question again , I really tried this for a whole day already but still can't get any solution...

 

Now I completed my submit form with validation , when I click submit , above the form will echo the values entered by user and a button for confirmation , if everything okay then just click the confirm button , it will update into mysql . (I do this using php function )

But even if I click the confirm button , it will just refresh my page and won't update into mysql . I know that it is because this button has no related to the submit form so there is nothing for it to update , but I still don't know how to find other ways to do it  . I even tried to put a disabled button first , when I click submit button then it will allow to click . Hmm...not a good way I know...(and won't works with my limited php knowledge)

 

Can I get a little hints for this problem ?

 

In my submit form

if(isset($_POST['Submit']))
{
    if($validator->ValidateForm())
    {

    $myfunction->show_confirmation();
                
    }

 

 

For the function part: ( another php file )

 

function show_confirmation(){


echo "Total recipient(s):".count($total)."<br>";
echo "<br>" ;
echo "Recipient Number(s):<br>".$_POST['cellphonenumber']."<br>" ;
echo "<br>" ;
echo "Message:<br>".$_POST['inputtext']."<br>" ;
echo "<br>" ;
echo "Date:".$_POST['datetime']."<br>" ;


echo "<br>";
echo "<br>";
echo " Proceed ?";
echo "<br>";

echo "<form>";
echo "<input type=\"submit\" name=\"Submit2\">

echo "</form>";

if(isset($_POST['Submit2']))
{
    $this->submit();
             
    }

}

 

submit() is just a function that will insert values into mysql table .

 

This is my normal form:

form1.jpg

 

After click submit button:

form2.jpg

 

 

So...what should I do to make the Submit2 button works ? Any hints or advices will be greatly appreciate .

I'm not asking for a whole complete solution but just some hints...thanks for every reply .

Some gray areas here. But when you do this:

echo "<form>";
echo "<input type=\"submit\" name=\"Submit2\">

echo "</form>";

This is your form. It has nothing in it. and your <form> tag does not have the action to submit this form to. Maybe insert the info above the form into the form.

 

PS. echo "<input type=\"submit\" name=\"Submit2\"> needs an ending "

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.