captain_scarlet87 Posted March 16, 2010 Share Posted March 16, 2010 Hello, I'm trying to upload some text to a table. It works perfectly well with one text box called 'Title' however when I add a second called 'Instructions' it comes up with this error: An error occurred in script 'C:\wamp\www\html\upload_instructions.php' on line 24: eregi() [function.eregi]: REG_BADBR Can you please help. Thank you. <?php # Script 13.6 - upload_instructions.php // This is the registration page for the site. // Include the configuration file for error management and such. require_once ('./includes/config.inc.php'); // Set the page title and include the HTML header. $page_title = 'Upload Instructions'; include ('./includes/header.html'); if (isset($_POST['submitted'])) { // Handle the form. require_once ('../mysql_connect.php'); // Connect to the database. // Check for a title. if (eregi ('^[[:alpha:]\.\' \-]{2,50}$', stripslashes(trim($_POST['title'])))) { $t = escape_data($_POST['title']); } else { $t = FALSE; echo '<p><font color="red" size="+1">Please enter your title.</font></p>'; } // Check for a instructions. if (eregi ('^[[:alpha:]\.\' \-]{2,1000}$', stripslashes(trim($_POST['instructions'])))) { $i = escape_data($_POST['instructions']); } else { $i = FALSE; echo '<p><font color="red" size="+1">Please enter your instructions.</font></p>'; } if ($t && $i) { // If everything's OK. // Add the user. $query = "INSERT INTO uploaded_instructions (title, instructions) VALUES ('$t', '$i' )"; $result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error()); if (mysql_affected_rows() == 1) { // If it ran OK. // Finish the page. echo '<h3>Thank you for submitting instructions!</h3>'; include ('./includes/footer.html'); // Include the HTML footer. exit(); } else { // If it did not run OK. echo '<p><font color="red" size="+1">You could not be registered due to a system error. We apologize for any inconvenience.</font></p>'; } } else { // If one of the data tests failed. echo '<p><font color="red" size="+1">Please try again.</font></p>'; } mysql_close(); // Close the database connection. } // End of the main Submit conditional. ?> <h1>Upload Instructions</h1> <form action="upload_instructions.php" method="post"> <fieldset> <p><b>Title:</b> <input type="text" name="title" size="100" maxlength="100" value="<?php if (isset($_POST['topic'])) echo $_POST['title']; ?>" /></p> <p><b>Instructions:</b><br><textarea name="instructions" maxlength="1000" rows="30" cols="120" value="<?php if (isset($_POST['instructions'])) echo $_POST['instructions']; ?>" /></textarea> </p> <div align="center"><input type="submit" name="submit" value="Upload Instructions" /></div> <input type="hidden" name="submitted" value="TRUE" /> </form> <?php // Include the HTML footer. include ('./includes/footer.html'); Quote Link to comment https://forums.phpfreaks.com/topic/195417-uploading-text/ 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.