Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


Advertisements:




SuperbHosting.net & Arvixe.com have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for BigResource.com.







Update Database When Form Input Contains Apostrophe?


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:

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


View 14 Replies (Posted: 01-21-2011, 02:35 PM)

Sponsored Links:

Related Forum Messages:
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:

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

[code]...

Posted: Dec 14 09 at 7:36

View 1 Replies!   View Related
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:

[Code]...

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)."'";

Posted: March 07, 2010, 05:20:17 PM

View 1 Replies!   View Related
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'");
$selectproda=mysql_fetch_array($selectprod);

[code]...

Posted: Oct 21st, 2010

View 9 Replies!   View Related
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?

Posted: 09-04-2009, 11:04 AM

View 1 Replies!   View Related
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)

Posted: April 21, 2010, 01:23:00 PM

View 3 Replies!   View Related
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 */ }

Posted: Jul 5 at 3:13

View 2 Replies!   View Related
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'])
<?php
require_once("admin.inc.php");
require_once("aauth.inc.php");[code]....

Posted: Posted 23 August 2009 - 10:53 PM

View 5 Replies!   View Related
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:

Posted: August 22, 2007, 07:55:05 AM

View 2 Replies!   View Related
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))
[Code]....

Posted: Nov 28th, 2007

View 9 Replies!   View Related
TinyMCE Apostrophe's Adds Backslash And Apostrophe
I have the following update statement:

[Code]......

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:.....

Posted: Jun 16, 2010, 10:44

View 2 Replies!   View Related
Update Database Using A Form
i would like to up date i have the following fields;

Prod_ID
Prod_Desc
Date_sent_in_house
Used_by_date
Supplier
Cases_sent
Cases_sold
Price_p

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

Posted: March 21, 2007, 11:06:02 AM

View 1 Replies!   View Related
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?

Posted: 07-20-2006, 09:46 AM

View 2 Replies!   View Related
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);

Posted: May 29, 2011, 11:49:23 AM

View 4 Replies!   View Related
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

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

Posted: February 11, 2011, 01:01:56 AM

View 1 Replies!   View Related
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:

Posted: 07-05-2006, 01:58 PM

View 2 Replies!   View Related
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.

Posted: September 15, 2010, 08:30:17 PM

View 2 Replies!   View Related
Updating Database With CSV File Apostrophe
My PHP code allows a user to update a database by uploading a CSV file. However if there are any special characters in a record (such as apostrophes) the database will not be updated properly. I know I need to escape the special characters, and I have tried reading the CSV file into a string and used 'addslashes' but MySQL calls for it to be put back into an array which I am unsure of. I am using PHP Version 5.2.10 so I fear that some of the possible solutions will not be available to me.

PHP Code:
<?php
//Upload File
if (isset($_POST['submit'])) {
if (is_uploaded_file($_FILES['filename']['tmp_name'])) {
echo "<h1>" . "File ". $_FILES['filename']['name'] ." uploaded successfully." . "</h1>";
}
[Code]....

Posted: 01-07-2010, 05:45 AM

View 8 Replies!   View Related
Echo An String Out With An Apostrophe In It From A Database?
echo an string out with an apostrophe in it from a database.Normally i wuld just use quote marks and i wouldnt have a problem but when you are trying to use it in an echo statement such as this what do you do? The variable $profile_street_1 is giving me the problem.

PHP Code:
echo "<a href='http://www.mysite.com/".$outlet_ext."' title='".$profile_street_1." - ".$profile_street_2."'>".$profile_outlet_name."</a>"; 

Posted: Mar 25, 2009, 10:40

View 3 Replies!   View Related
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.

$username="****";
$password="****";
$database="****";
$owner=$_POST['Owner'];
$char=$_POST['Charecter'];
$join=$_POST['Joined'];

[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

Posted: 09-22-2009, 03:35 AM

View 11 Replies!   View Related
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)

Posted: Oct 17th, 2010

View 4 Replies!   View Related
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">
<tr>
<td>Player

[Code].....

Posted: June 16, 2011, 08:45:14 AM

View 5 Replies!   View Related
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?

Posted: Mar 15 11

View 2 Replies!   View Related
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:

<?php
session_start(); 
// Place Session variable 'recid' into local variable
$recid          = $_SESSION['recid'];
$username    = $_SESSION['name'];

[Code]....

Posted: August 29th, 2010, 12:44 AM

View 5 Replies!   View Related
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

Code:
<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.

[code]....

Posted: 04-29-2010, 07:49 AM

View 5 Replies!   View Related
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

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

[Code]....

Posted: January 04, 2011, 07:44:04 AM

View 8 Replies!   View Related
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. 

Posted: February 22, 2011, 03:23:16 PM

View 2 Replies!   View Related
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.

Posted: July 02, 2011, 10:45:53 AM

View 14 Replies!   View Related
Apostrophe Crashing Form Script
When I try to update a php script that writes my form entries to the database it fails. It usually works, however, when I use the ' apostrophe, it crashes.

What must I add to my code to allow the ' or ` symbol to be ignored and not crash the system?

Posted: November 27, 2007, 12:49:05 AM

View 3 Replies!   View Related
Apostrophe Stop Database Text Showing?
Apostrophes stop any more text after it showing in link titles.For example, on the right hand side half way down the page the album name:You're The Designers, We're The Deciders for the band Not Advised.if you hover, or check the source - it stops at You.The code is:

Code: [Select]echo "</td><td class='listingtitle'>Artist: <b></td><td><a href='http://megalyrics.net/search.html?c=".$row[artist]."' alt='View ".$row[artist]." Lyrics' title='View ".$row[artist]." Lyrics'>".$row[artist]."</a></b></td></tr><tr><td class='listingtitle'>Album:</td><td><a href='http://megalyrics.net/search.html?c=".$row[album]."' title='View ".$row[album]." Lyrics' title='View ".$row[album]." Lyrics'>".$row[album]."</a></td></tr><tr><td class='listingtitle'>Views:</td><td><font color='#444444'>".$row[views]."</font></td></tr>";
[code]....

Posted: December 13, 2009, 01:17:51 PM

View 2 Replies!   View Related
Insert Integers In The Database Without Manually Input In Form?
how can I insert integers in the database without manually input it in the form. I am looking to fill the product_id and customer_id table. I would do it but only by sequence and '' quotes at the VALUE part of an INSERT statement. Also condition the insert of product_id and customer_id according to the id in the SESSION variable.

Code: [Select]<?php 
session_start();
if (isset($_SESSION['id'])) {

[code]....

The above insert its respective fields in each table but how is it possible to INSERT it according to the SESSION['id]; so that it INSERT according to the costumer id plus that it generates and INSERT automatically in the product_id and customer_id related to the product_id and customer_id fields in products and customer table? without manually doing it.

any references will be appriciated because the above code seems like the product_id and customer_id won't INSERT in relations to the customer and product table. One more thing the product_id and customer_id won't be pass from the form to this file but rather a value will be INSERT it in their field according to the id in customer and products table.

Posted: April 09, 2011, 01:48:13 AM

View 5 Replies!   View Related
Selecting MySQL Database Row Based On Form Input?
We recently upgraded from PHP4 to PHP5 and the below script that was working perfectly in 4 has completely stopped working and I can't figure out why for the life of me. I'm not an experienced PHP programmer--I've done some forms, but this is the first time I've used a database.

What needs to (and was) happen: A user enters their username in the form and gets a readout of their participation so far that month.The problem(s): I know that it's storing the variable 'user' because it echoes it back properly, but the database is no longer allowing me to select the row based on that variable. I know it's not that I can't connect to the database because if instead of '$user' I change the code to a username I know is in there, I get the proper readout. This all started as soon as I transferred over to PHP5--before that, no problems at all.

The database information is all correct, I just took it out for privacy's sake.

<form id="feedback" method="post" action="index.php">
<input name="user" type="text" value="Enter user name" size="20" maxlength="50" /><br />

[code]...

I've got a couple hundred people who use this on a regular basis and are starting to ask why it's not working.

Posted: March 23, 2011, 08:39:59 PM

View 3 Replies!   View Related
Subscribe Form Where Users Can Input There Name And Email To The Database?
im trying to create a subscribe form where users can input there name and email to the database, I need to ensure everythings safe, so far I have this, I need to validate my email but im unsure, would I put the validation script on the page containing the form or should it go on this page with the insert script?Ive been reading w3schools and php.net but I cant seem to take anything in..

Code: [Select]<?php
$con = mysql_connect("localhost","mydb","mypassword");
if (!$con)[code].....

Posted: December 15, 2009, 06:43:44 PM

View 5 Replies!   View Related
Update User's Password In Database Using A Form?
This code is supposed to let the user change their password by typeing into the form their username and their old password and then their new password and they need to confirm the new password but the page ends up not updateing the password it just says that the password is updated. What should i do about it?

PHP Code:

<?php
// Connects to your Database
mysql_connect("localhost", "email", "qwe") or die(mysql_error());
mysql_select_db("email") or die(mysql_error());
//This code runs if the form has been submitted

[Code].....

Posted: 08-25-2010, 02:24 PM

View 14 Replies!   View Related
Code That Should 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

<?php
session_start();
?>
[code].......

Posted: 01-04-2011, 07:48 AM

View 2 Replies!   View Related
Code To Tgake Input From A Html Form And Post It Into My Database.
Can anyone give me some code to tgake input from a html form and post it into my database.

Posted: November 7th, 1999, 12:59 PM

View 4 Replies!   View Related
Adding Html Tags To Form Input And Save In Database?
I use this to get info from post values and save it to database. The problem is that it doesnot add html tags like <br /> or <strong> to database. What am I doing wrong?PHP Code:

<?php //Connect to database, all incoming posts from sql injection 
$cat= new mysql($db_host, $db_user, $db_password, $db); 
$cat->connect();  $cat->select();

[code]...

Posted: July 11th, 2009, 07:58 PM

View 10 Replies!   View Related
Using Checkboxes As Part Of Html Form To Update Database?
I currently have a form to update existing records in a database, which all works fine now. The database contains information about shows on a radio station. Some shows are on one day, some are on a few different days, ie. one might be on Mondays, one might be Mondays, Wednesdays and Fridays, etc. I want to include as part of the form checkboxes for each day of the week, so the information about what day each show is on can be updated by checking or unchecking the appropriate boxes.

I have so far created seven new fields in my database, one for each day of the week, the idea being that they are set to either true or false, depending on the days the show is on. Is this the most sensible way of going about it? Now I'm just struggling with making the checkboxes work. I need to display them as part of the form either checked or unchecked - depending on what is already in the database (ie if they have already been set to true or false). Then the checking or unchecking of the boxes by the user must update the database. The code for the pages involved is as follows:

To choose which show to update:

Code:
<html>
<head>
<title>Update Shows</title>
</head>

[code]....

Posted: 02-11-2009, 02:10 PM

View 4 Replies!   View Related
Music Is Entered Into The Database Using The Alternate Apostrophe But No Results Will Show
We all know how there's different representations for apostrophes. There's the character and then there's '. This is affecting the search application on my website. If someone searches for John's Music, but it just so happens John's Music is entered into the database using the alternate apostrophe (John's Music), no results will show.

Posted: Mar 12th, 2010

View 3 Replies!   View Related
Generating Pages Automatically Based On Form Input And MySQL Database
I'm a bit of a PHP noob, so will try my best to describe what I'm trying to do... I am working on a front-end 'news upload' system which will allow any members of my organisation to upload news items to our news database using an HTML form.

I have coded as far as when it comes to generating the stand-alone pages for news items themselves. I have the data in the fields in the database outputting onto our homepage as desired but would also like to generate a new PHP page for each item that is uploaded as well, but I am unsure as to how to go about this.

Basically, at the same time that the homepage is being updated (immediately after writing the data to the database) I would like to generate a stand-alone .php file in it's own directory, say 'news'. I hope this makes sense?

Posted: 10-07-2009, 11:21 AM

View 8 Replies!   View Related
Copyright © 2005-08 www.BigResource.com, All rights reserved