Jump to content

eldredm

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Posts posted by eldredm

  1. I am sure someone has come accross this before:

    I am putting togther a content management website, I want to insert some text into a mySQL database. I have a php page with a form to type in my text, then when a submit the info, I re-direct to a validation page to make sure that the user has caputed all the fields.

    Should I leave one of the fields out, the script will redirect back to the HTTP referer page with a message below that particular field stating that "this field cannot be a null string" When the script redirects page to the page with the form, every single word that had an apostrophe, now has an apostrophe with a backslash, like so: [b]someone's is now someone\'s[/b].

    I think it has something to do with my insert statement:

    $query = "INSERT INTO news SET " .
    "new_id = NULL, " .
    "title = \"" .
    $formVars["title"] . "\", " .
    "description = \"" .
    $formVars["description"] . "\", "
    "date = \"".
    $formVars["date"] . "\"";

    By the way formVars variable is used for validation

    Here is some code for validation:

    //Validate the description for instance

    if(empty($formVars["description"]))
    //the description cannot be a null string
    $errors["description"] =
    "The description field cannot be blank.";
    elseif (strlen($formVars["description"]) > 4000)
    $errors["description'] =
    "The description can be no longer than 4000 " .
    "characters";

    If I remove the backslashes from the INSERT STATEMENT, then I get a parse error ?
    If I fill in all the fields, the validation script writes to the DB, and when I query the DB to display the text from the DB, I still have these back slashes ?

    In mySQL DB, my field type is a BLOB,

    Any Suggestions please ?

    Thankyou
    Eldred
  2. Hi there

    Newbie with php, I have managed to create hyperlink from my resultset and diplayed it on my page, however, because I am working with frames, how do I get target=mainFrame embedded in my hyperlink.

    This is my sample code:
    echo "<tr>\n\t<td bgcolor=\"white\">" .
    "<b><font color=\"black\">" .
    $row["date"] . "<a href=\"viewContents.php?newID=" .
    $row["new_id"] ."\">View</a>" ;

    where in the syntax do I place : target=mainFrame

    Hope someone can help ?

    Thanks
×
×
  • 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.