PHP - Moved: Tinymce Won't Submit My Form Data!! Please Help (code Included)
This topic has been moved to JavaScript Help.
http://www.phpfreaks.com/forums/index.php?topic=347131.0 Similar TutorialsAdvance thank you. Can you help please. The error..... Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given in C:\wamp\www\test_dabase.php on line 24 code. Code: [Select] <?php //database connection. $DB = mysql_connect("localhost","root") or die(mysql_error()); if($DB){ //database name. $DB_NAME="mysql"; //select database and name. $CON=mysql_select_db($DB_NAME,$DB)or die(mysql_error()."\nPlease change database name"); // if connection. }if($CON){ //show tables. $mysql_show="SHOW TABLES"; //select show and show. $mysql_select2="mysql_query(".$mysql_show.") or die(mysql_error())"; } //if allowed to show. if($mysql_select2){ //while it and while($data=mysql_fetch_assoc($mysql_select2)){ //show it. echo $data; } } ?> Say there is a complex opt in process where people start to enter their data but certain questions stop them where they close out of the page. They already entered their data and I feel there is a way to grab it and post it to mysql even though they do not click submit.
How would this be done?
A super simple example (proof of concept) or a link to a tutorial would be very useful.
Edited by brentman, 23 September 2014 - 10:42 AM. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=323252.0 This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=323588.0 This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=356816.0 I have a form using PHP to submit to MySQL DB and also uses PHP for validation. It worked before I added the validation stuff, so something must be wrong, but I am not sure what. I don't get any errors. Here is the code for the form <?php include("validation.php"); ?> <form id="ContactForm" method="POST" action=""> <fieldset> <div> <label>First Name</label> <input id="FirstName" name="FirstName" maxlength="120" type="text" autocomplete="off" value="<?php echo $valid_FirstName; ?>" /> </div> <div> <label>Last Name</label> <input id="LastName" name="LastName" maxlength="120" type="text" autocomplete="off" value="<?php echo $valid_LastName; ?>" /> </div> </fieldset> <fieldset> <div> <label>User Name</label> <input id="UserName" name="UserName" maxlength="120" type="text" autocomplete="off" value="<?php echo $valid_UserName; ?>" /> </div> <div> <label>Password</label> <input type="password" id="Password" name="Password" maxlength="120" type="text" autocomplete="off" value="<?php echo $valid_Password; ?>" /> </div> <div> <label>Email</label> <input id="email" name="email" maxlength="120" type="text" autocomplete="off" value="<?php echo $valid_email; ?>" /> </div> </fieldset> <fieldset> <div> <label>Zip Code</label> <input id="Zip" name="Zip" maxlength="12" type="text" autocomplete="off" value="<?php echo $valid_Zip; ?>" /> </div> <div> <label>Birthday (mm/dd/yyyy format)</label> <input id="Birthday" name="Birthday" maxlength="12" type="text" autocomplete="off" value="<?php echo $valid_DOB; ?>" /> </div> <div> <label>Security Question</label> <input id="Security" name="Security" maxlength="255" type="text" autocomplete="off" value="<?php echo $valid_Security; ?>" /> </div> </fieldset> <fieldset> <div class="controls"> <input id="submit" type="submit" name="submit" value="CREATE PROFILE"/> </div> </fieldset> </form> and the validation and submit to DB <?php ; $db_user = ""; $db_pass = ""; $db = ""; $link = mysql_connect('localhost',$db_user,$db_pass); $db_selected = mysql_select_db($db); /*debugging*/ if (!$link) { die('Could not connect: ' . mysql_error()); } if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } if($_POST) { $FirstName=mysql_real_escape_string($_POST['FirstName']); //This value has to be the same as in the HTML form file $LastName=mysql_real_escape_string($_POST['LastName']); //This value has to be the same as in the HTML form file $UserName=mysql_real_escape_string($_POST['UserName']); //This value has to be the same as in the HTML form file $Password= md5($_POST['Password']); //This value has to be the same as in the HTML form file $email=mysql_real_escape_string($_POST['email']); //This value has to be the same as in the HTML form file $Zip=mysql_real_escape_string($_POST['Zip']); //This value has to be the same as in the HTML form file $Birthday=mysql_real_escape_string($_POST['Birthday']); //This value has to be the same as in the HTML form file $Security=mysql_real_escape_string($_POST['Security']); //This value has to be the same as in the HTML form file // First Name if (eregi('^[A-Za-z0-9 ]{3,20}$',$FirstName)) { $valid_FirstName=$FirstName; } else { $error_FirstName='Enter valid First Name.'; } // Last Name if (eregi('^[A-Za-z0-9 ]{3,20}$',$LastName)) { $valid_LastName=$LastName; } else { $error_LastName='Enter valid Last Name.'; } if (eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})$', $email)) { $valid_email=$email; } else { $error_email='Enter valid Email.'; } // Usename min 2 char max 20 char if (eregi('^[A-Za-z0-9_]{3,20}$',$UserName)) { $valid_UserName=$UserName; } else { $error_UserName='Enter valid Username min 3 Chars.'; } // Password min 6 char max 20 char if (eregi('^[A-Za-z0-9!@#$%^&*()_]{6,20}$',$Password)) { $valid_Password=$Password; } else { $error_Password='Enter valid Password min 6 Chars.'; } // Zip if (eregi('^[A-Za-z0-9 ]{3,20}$',$Zip)) { $valid_Zip=$Zip; } else { $error_Zip='Enter valid Zip Code.'; } // Security Phrase if (eregi('^[A-Za-z0-9 ]{3,20}$',$Security)) { $valid_Security=$Security; } else { $error_Security='Enter valid Security Phrase.'; } if((strlen($valid_FirstName)>0)&&(strlen($valid_LastName)>0)&&(strlen($valid_UserName)>0)&&(strlen($valid_Password)>0)&&(strlen($valid_email)>0)&&(strlen($valid_Zip)>0)&&(strlen($valid_DOB)>0) &&(strlen($valid_Security)>0) ) { mysql_query("INSERT INTO Profile (`FirstName`,`LastName`,`Username`,`Password`,`email`,`Zip`,`Birthday`,`Security`) VALUES ('$FirstName','$LastName','$UserName','$Password','$email','$Zip','$Birthday','$Security')" ); header("Location:login.php"); } else{ } } ?> This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=319994.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=332865.0 This topic has been moved to HTML Help. http://www.phpfreaks.com/forums/index.php?topic=346552.0 This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=355809.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=333815.0 I have a snippet of code like this below. If I have it directly on my page, it works fine. But if I move this snippet of code into an include file and use "require_once('thefile.php');", the code no longer works properly. How is that possible? FYI, this snippet is in the middle of a for loop on the regular page. Maybe you can't use includes when in a loop? I don't know. Makes no sense that it works when on the page, but not when included using require once. Any thoughts how this could be possible? I imagine there is some rule with include files that I'm missing??? This is the code and I don't think it matters exactly what its doing so I won't bother you with that. This is how it looks on the page itself... Code: [Select] if ($type=="one") { $_SESSION['cluenum']=1; //so clue #1 begins as the selected clue echo "<script type='text/javascript'>document.getElementById('clue1').style.border = '1px solid red';</script>"; //sets the styling on clue #1 $allcode = "onclick='setnumber($i);'"; } else { // type must be equal to all, so don't do anything special $allcode=""; } This is how it looks in the include file... Code: [Select] <?php if ($type=="one") { $_SESSION['cluenum']=1; //so clue #1 begins as the selected clue echo "<script type='text/javascript'>document.getElementById('clue1').style.border = '1px solid red';</script>"; //sets the styling on clue #1 $allcode = "onclick='setnumber($i);'"; } else { // type must be equal to all, so don't do anything special $allcode=""; } ?> This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=326600.0 hi i am trying to make a payroll calculator script that takes employee info, calculates pay, displays submitted info in a table, stores info in an array, and updates the array when new info is submitted. i have most of these accomplished, i am having trouble with the "store into an array, and update the array when new info is submitted" parts of the project. i am still not very fluent in php so there may be easier ways to achieve what i have so far. any pointers would be a great help, this part has got me stumped. The attached code works perfect for me. This code displays data from my mysql database in a browser & allows me to edit it, then re-submit it to the mysql database. Again, all of this works great. I was wondering if there was a way way for me to add some code to this existing code that would send me an email with the information in the form when the submit button is clicked? Nothing fancy....I'd just like to get an email based off of the location, for example if the location is changed from "Office1" to "Office2", I'd like the email to go to office2@mail.com. If "Office3" is entered, I'd like the form info to go to office3@mail.com. Is this possible? Hi folks, This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=342211.0 Hey All, I will be marketing a simple php script shortly and would like to Obfuscate my code and have it check to see if the person is running the script on the proper domain, much like other Purchased Scripts, you have to buy licenses and some are limited to a Per Domain basis. Could I use cURL to run a script on another server (mine) that takes the URL it came from, and a variable "the auth key" and check if the person is using the script on the proper domain? If the domain and auth key don't match in the DB i would return a message saying invalid key or something, else continue to execute the script. <?php //authkey would be defined in config file $authkey = "769870afhljkzxf90436"; $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,"http://example.com/page.php?authkey=$authkey"); curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $buffer = curl_exec($curl_handle); curl_close($curl_handle); if (empty($buffer)) { print "Sorry, AuthServ is performing maintenance.....<p>"; } else { print $buffer; } ?> Is there a smarter way to do this? I don't have an extra 300 bucks to use something like ioncube, just looking for a general proper direction on going about this as I am totally clueless. thanks This topic has been moved to Other Libraries and Frameworks. http://www.phpfreaks.com/forums/index.php?topic=314194.0 Say I have an "Entries" table. I want to submit same multiple entries using a form submission. And If I have other queries submitted in the same form, I want those quarries to be submitted only once. Is that possible to do? Here's my code. if(isset($_POST['submit'])) { $entries = 10; $id = 55; $name = 'Smith'; $insert = $db->prepare("INSERT INTO entries(id, name) VALUES(:id, :name)"); $insert->bindParam(':id', $id); $insert->bindParam(':name', $name); $result_insert = $insert->execute(); if($result_insert == false) { echo 'Fail'; } else { echo 'Success'; } } ?> <form action="" method="post"> <input type="submit" name="submit" value="SUBMIT" /> </form> Edited January 13, 2019 by imgrooot |