Update Database When Form Input Contains Apostrophe?

Jan 21, 2011

I have created a form which pulls info from a mysql db, allowing user to edit the details by overtyping but I am tearing my hair out with a problem I am getting when the user enters an apostrophe. I will try to illustrate with a few select lines of code first.Form page code excerpt:

<form method="post" action="admin_confirm_edit.php">
<textarea name="newmaindesc" cols="70" rows="10"><?php echo $row[6]; ?>

View 14 Replies


Use Arrays For Form Input And Update Respective Database Records?

I'm new to PHP... I want to know how to populate a form from mySQL. I'm stumped at the input section where I am trying to allow the user to select choices for radio button /checkbox for each record. TCHere's a snippet of my code:

$mQuantity = 1;
$con = mysql_connect("localhost","t","c");


View 1 Replies

Add Form To Joomla Database Using Apostrophe

I have a problem with adding information to a database using both mysql and Joomla. I know people don't normally bother with this but I want to know how to add an apostrophe to a field name that will allow this to be added to the mysql database. Making a code like this, will prob have to be added to the database.php file as it is where the insert statements are. I may be wrong.....just want to be corrected. It may also have to be where all the insert statements are outside of the database.php file too. There is a javascript like:


Whats the disadvantages of using mysql_real_escape_string, and where shall i put the stripslashes($user_name) when i display it back on a page or it will have the ""? as shown in line 2 above. Finally, another way i heard of is changing all they mysql insert statements to something like:

Code: [Select]$sql = "INSERT INTO mytable SET comments = '".mysql_real_escape_string($user_name)."'";

View 1 Replies

Select 'apostrophe' From Database To Display In Form's Field?

I used mysql_real_escape_string to insert a data with apostrophe, in the database, using php.But when I want to select this data and display it in a form's field, it does not work.What happens is that the data before the apostrophe is displayed in the field, but what is after the apostrophe is displayed outside of the field.Does mysql_real_escape_string only work for insert?

Here is my code:
$produpd = $_POST['id-uprod'];
$selectprod=mysql_query("SELECT * FROM products WHERE id='$produpd'");


View 9 Replies

Add To Make - Allow Input Of An Apostrophe?

I use the following string to validate inputs:

$patternAlphanum1 = "/^[A-Za-z0-9_- ]+$/";

What do I need to add to this to make it allow input of an apostrophe?

View 1 Replies

Create / Update File When Update The Database By Submitting The Form

I have some data in database, i need to create/update file when i update the database by submitting the form

1) the file must contain all the content in database
2) each time i generate or update the record, it must update(or rewrite on the file all the record + new record)

View 3 Replies

Form Field Input Empty Than Do Not Update

I have a form that updates a user's info. How can I tell the form to NOT update certain fields when left blank? if(trim($email) == '') { /* don't update */ }

View 2 Replies

Form Update - Database Dosen't Update?

I am working on a script. I made a page that worked and copied and pasted to a new page and changed the coding. The page is supposed to Manage FAQ from an admin panel. Picture here. Picture of Page When I type in my question and answer the database dosen't update. When I click add all the page does is "refresh". I can't seem to find my error. I am using the textarea tag if that makes a difference. The loop that I want to use is the

if ($_POST['do'] == "save" && $_POST['question'])

View 5 Replies

How To Update Form Input Field Background Colour On Validation Error

I have been searching for form validation scripts for ages and all th ones that I like are far too complicated and inflexible so I decided to stick with my own which is easier to understand.

The only thing I don't like which i have seen on better form validation scripts is that and fields with errors are highlighted. i can only presume that they have used php to set the background color of the input field or textarea.

How would I add some code to change the background colour of form elements if an error is found? Here is my code which validates the form but doesn't change form elements colours. Code:

View 2 Replies

Dreamweaver Form Validation And Redirect Them Back To The Form Page Without Comment Input To The Database

I post this solution to a form validation and redirect as an addition to a comment page written with dreamweaver. Unfortunately Dreamweaver does not provide server-side validation for php. You're expected to purchase an extension. My problem I have a comments page with a comment form. I wanted the comment input to a database if ok but if a user tried to input code or a link, I wanted to redirect them back to the form page without their comment input to the database. I also needed to work out where in the Dreamweaver written code to place my validation and redirect.

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "comments"))
$comment = htmlentities($_POST['comment']);
function check_field1($comment)
if (preg_match("/</", $comment))

View 9 Replies

TinyMCE Apostrophe's Adds Backslash And Apostrophe

I have the following update statement:


And look at the "Smithills Country Park" review, you will see that where there should be an apostrophe it shows the word like this: Quote:.....

View 2 Replies

Update Database From A Form

I'm still learning PHP while im making a user-account system on a site. So all this is helping me learn. What i need to know is, when a person submits a registration form, how do you make it submit to your database and create a membership for them?

View 2 Replies

Update Database Using A Form

i would like to up date i have the following fields;


from a form i would like to enter new data into the database table., but unsure on how do do this can you help?

View 1 Replies

Update Database Using A Form?

I am trying to update my database using a form. While submitting this function is called, but nothing is changed. If I replace the variables with values, the function works fine, but not with variables.

Code: [Select]function updateCandidate($id, $F_Name, $L_Name, $Gender, $Bday, $PhoneNo, $Address, $City, $Country, $Nationality, $experience, $Stat)
$q = "UPDATE candidates SET F_Name = '$F_Name', L_Name='$L_Name', Gender='$Gender',
Bday='$Bday', PhoneNo='$PhoneNo', Address = '$Address', City='$City',
Country = '$Country', Nationality = '$Nationality', Experience_idExperience='$experience',
Status= $Stat WHERE Users_UsersID = $id";
return mysql_query($q, $this->connection);

View 4 Replies

Update Database Form?

been trying to get a code up and working for a update database form, couldnt really get any working i found from google and then after a bit of help from here i got a crazy idea and stopped dead and my tracks and switched gears. so i thought, why not just use the form i used to insert my database and change it around a little. same concept, how should this not be possible ? for reference here are my tables and structure

ID(PK) Title Category(FK) URL
0 Name 1 http://www.

View 1 Replies

Form To Input A Few Fields Into A Database.

This is the processing i'm using for a form to input a few fields into a database. PHP Code:

View 2 Replies

Storing Form Input Without A Database?

I've been messing around with HTML forms and processing them via PHP. I have zero experience with databases and I don't have the time to learn it right now. I have a web based survey that my boss wanted me to try to develop, the problem is that it needed to be done a month ago. I've been working on it for about a week and I think it's good enough for now...but, without knowing how to store the form input in a database I'm coming up short on figuring out how to store the data.

I was trying to write a simple .csv file to import into Excel but the form has textarea's and if a user sends a carriage return it completely breaks the csv format.I'm currently using fwrite($fp, """.$fields.""".","); since I couldn't get fputcsv to work at all. This works great until it gets to the variable which contains the carriage returns which it passes to the csv file. You can see the form on my personal server at [URL]. The last page is just a page of echo commands to make sure the session variables are getting passed properly.

View 2 Replies

Update Database Rows With A Form?

how can i update a data from a form so that the data in the database will change also.

what are the required coding that i should use?

i have a table in a database that user will insert data, after that, i will search the data according to NoId, after found it retrieve all the data and show in a form, how can i edit the data from the form and the data in database will change same according to the edit?

View 2 Replies

Form Fails To Update Database

This form does not update the database. I know it is accessing the database because the checkbox and radio buttons variables are good, but there is no result posted.

PHP Code:

// Place Session variable 'recid' into local variable
$recid = $_SESSION['recid'];
$username = $_SESSION['name'];


View 5 Replies

Update Database Through An HTML Form?

I am trying to update My database through an HTML form. To be more clear, i have a poll management database,I list the polls by generating a dynamic table. The user has operations (Update, Delete, Insert new polls).The user can perform these operations by clicking on the Table Row

<td><a href="update.php?operation=U&id=<?php echo $polls[$i]['id']?>">Update</a>

it works well there, after clicking on that link, it directs to update.php. there's simply a form there where 1 can enter update values. but when i submit the form i get the following errors.


View 5 Replies

Can't Get Form To Update MySQL Database

I am having trouble updating a table in my database. The collum in the table i want to update is called 'transferstatus'

Here is my form

<form action="transfers-script.php" method="post">
<table width="500" border="0" cellspacing="10" cellpadding="5">


View 5 Replies

Update Database On Submit Of A Form?

i have this code that should update database on submit of a form.

i have multiple rows selected from a database and i need to be able to update each row individually... however currently as the code stands it updates all rows with the data entered into the bottom row.

here is the code

<a href="adminlogout.php">Logout</a><br />
$id = $_GET['id'];


View 8 Replies

Update Existing Database With Web Form?

Basically I have a table that has fields of Week, Jersey, Name, Goals, Assists, Points, and Penatly_Min. what I did is have a record for each player for each week. I already pre-created a record for each player for each week.

I just need a web form that will update these existing records. I already created one that can add new records but I am having a tough time creating one to update existing ones.

I'd like to be able to select the week (week 1-10) then select a player and update his stats for that particular week.

View 2 Replies

Update Database Tables From A Form?

I am trying to update Database Tables from a form. Obviously doesn't work. I have tried to follow a few tuts on the web but alas, nothing.

<?php $SQL = "UPDATE settings SET email = '$email';
SET site_title = '$site_title'"; ?>

All I want to do for now is update the settings table as above. But nothing I try works. I keep getting errors saying that email and site_title are undefined. Yet, they work fine as these values are displayed on the site from the database.

View 14 Replies

Input Information Into Database From A Html Form?

Ok I'm trying to input information into my database from an html form. The following is my php code.



I then get the following error when I attempt to submit the info.

Fatal error: Call to undefined function msql_query() in /home/phptest/insert.php on line 22

View 11 Replies

Saving User Input From Form To Database?

I essentially, using PHP and MySQL, allow a user to enter character data into a form, submit the form, and next have this data saved to the database, then a formatted version of said character data returned to the user's machine and displayed in the browser. (Similar to how I am entering text here, submitting and having a visible formatted copy to view)

View 4 Replies

Copyrights 2005-15 www.BigResource.com, All rights reserved