Jump to content

infinitix

New Members
  • Posts

    7
  • Joined

  • Last visited

infinitix's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Mac first off, I appreciate the help a lot man. I'm going to the library tomorrow in hope to find a relevant book that I can learn some Mysqli and PDO. If I'm going to do this I want to do it right Any books or learning materials that you suggest for a beginner as myself?
  2. Would anyone have any recommendations for a book or any other materials that I can use to start my learning experience and grasp these concepts more? Something that is reader friendly and well laid out preferably.
  3. I removed the ( "i" ) from the escape strings, still empty in the database and upon submitting the form this is displayed again: Array ( [formID] => Contact [redirect_to] => http://www.cavalierchampions.com [Name] => Your Name [E-Mail] => Your E-Mail [Website] => Your Website [Comments] => test ) I checked the collation and everything to see if that may effect it, the collation is set to utf8_general_ci
  4. I am using phpmyadmin to view the DB. I feel like the escape string is consistent with what you are saying, it is before the insert and it is defined as part of the value. For the <textarea>output goes here</textarea> I'm a little confused by what you mean. I have the echo command in between the text area and from my understanding of what you are saying that is incorrect. I remember reading something about values can't be assigned to text area's but i could be mistaken but every example i've seen has the text area setup as followed: $link = mysql_connect (DB_HOST, DB_USER, DB_PASSWORD); if (!$link) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db(DB_NAME, $link); if (!$db_selected) { die('Can\'t use ' . DB_NAME . ': ' . mysql_error()); } echo "<pre>"; print_r($_POST); echo "</pre>"; $value = mysqli_real_escape_string ( $link , $_POST['Name'] ); $value2 = mysqli_real_escape_string ( $link , $_POST['E-Mail'] ); $value3 = mysqli_real_escape_string ( $link , $_POST['Website'] ); $value4 = mysqli_real_escape_string ( $link , $_POST['Comments'] ); $sql = "INSERT INTO `contact` (`Name`, `E-Mail`, `Website`, `Comments`) VALUES ('$value', '$value2', '$value3', '$value4')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } mysql_close(); ?> I removed some of the other input types to focus on the text area.. <form action="contactdb.php" method="post"/> <input type="hidden" name="formID" value="Contact" /> <input type="hidden" name="redirect_to" value="http://www.cavalierchampions.com" /> <textarea name="Comments" rows="4" cols="40" id="Comments"><?php echo $Comments;?></textarea><br><br> <input type="submit" value="Send"> <input type="reset" value="Reset"> </form>
  5. When I use the print_r: Array ( [formID] => Contact [redirect_to] => http://www.cavalierchampions.com [Name] => john doe [E-Mail] => email@gmail.com [Website] => website.com [Comments] => test )
  6. I tried the above corrections and I'm still lost as it is not working and when I use the sanitize escape string no values are posted to the DB. http://s30.postimg.org/qeqcpass1/contactdb.png http://s27.postimg.org/fsegje4w3/contactus.png http://s29.postimg.org/h9ouaqcfr/database.png As you can see for ID 3 and ID 4 nothing was returned to the DB when I add the escape string and the comments is still empty.
  7. I've spent the past 2 days googling and trying different methods that people have recommended other people try yet still I come up with the same problem. I am new to coding and I am learning the basic functions so all feedback is welcome in aiding my learning endeavor. I am using a form and all of the inputs are submitting to the database other than the text area which comes up blank. I do not get an error when submitting the form I just get a blank value for the text area 'Comments'. FORM <form action="contactdb.php" method="post" form="contactdb"/> <input type="hidden" name="formID" value="Contact" /> <input type="hidden" name="redirect_to" value="http://www.cavalierchampions.com" /> <label>Name:</label><br> <input type="text" name="Name" size="30" maxlength="100" value="Your Name"><br> <label>E-mail:</label><br> <input type="text" name="E-Mail" size="30" maxlength="100" value="Your E-Mail"><br> <label>Website:</label><br> <input type="text" name="Website" size="40" maxlength="150" value="Your Website"><br> <label>Comment:</label><br> <textarea name="Comments" rows="4" cols="40" id="Comments" form="contactdb"><?php echo $Comments;?></textarea><br><br> <input type="submit" value="Send"> <input type="reset" value="Reset"> </form> CONTACTDB.PHP $value = $_POST['Name']; $value2 = $_POST['E-Mail']; $value3 = $_POST['Website']; $value4 = $_POST['Comments']; $sql = "INSERT INTO `contact` (`Name`, `E-Mail`, `Website`, `Comments`) VALUES ('$value', '$value2', '$value3', '$value4')"; As noted above I get returned values for $value, $value2, and $value3 but not $value4 (The 'Comments' text area)
×
×
  • 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.