Spraban9 Posted March 19, 2013 Share Posted March 19, 2013 hi guys, i create the form for registration i going to confirm via phone number "INSERT INTO ozekimessageout (receiver,msg,status) VALUES ('".$contact."','".$randomno."','send')" this query is working but i want to save this for button click event but already i have the save button for registration form i want one more button to run this query plz help me guys. Quote Link to comment Share on other sites More sharing options...
Strider64 Posted March 19, 2013 Share Posted March 19, 2013 (edited) You could do something like this? <form action="user.page.php?page=3" method="post"> <input type="hidden" name="action" value="process" /> <input type="text" name="phone" value="" /> <input type="submit" name="submitButton" id="submitButton" value="SUBMIT" /></form><br /> Then all you have to do is something like this if ( isset( $_POST["action"] ) and $_POST["action"] == "process" ) { $phone = htmlspecialchars($_POST['phone']); // Your function to the write to database? } The above would probably be best at the top of you page before the header portion of your html. Edited March 19, 2013 by Strider64 Quote Link to comment Share on other sites More sharing options...
Spraban9 Posted March 20, 2013 Author Share Posted March 20, 2013 (edited) but it not working i try this coding if ( isset( $_REQUEST["action"] ) ) { $phone = htmlspecialchars($_POST['contact']); $que=mysql_query("INSERT INTO ozekimessageout (receiver,msg,status) VALUES ('".$phone."','".$randomString."','send')"); } plz help me i want save this message on buttin click <label>Contact No</label></span></td> <td><input required name="contact" type="text" value="" width="250" $pattern = "/^(\+94\s?7\d{3}|\s?\d{3}\s?\d{3}$/"; x-moz-errormessage="Mobile Phone is Required!"><input type="button" name="action" value="process" /> Edited March 20, 2013 by Spraban9 Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted March 20, 2013 Share Posted March 20, 2013 What do you mean by "save this for button click event"? Are you looking to process the query using PHP...or with a client side language like JavaScript? In other words, is it okay for the page to reload or are you trying to get the update to happen without the page going anywhere? Quote Link to comment Share on other sites More sharing options...
Spraban9 Posted March 21, 2013 Author Share Posted March 21, 2013 save button click ever means that i want the insert data before click the submit button i want to run this coding "INSERT INTO ozekimessageout (receiver,msg,status) VALUES ('".$contact."','".$randomno."','send')" after enter the contact no Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.