SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast MarkW78's Avatar
    Join Date
    Mar 2001
    Location
    Wellington, Ohio
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie-type question

    Hi. I'm only just trying to figure out how to implement MySQL databases into my website. I am using PHP to do this.

    The problem I am having is actually in passing a variable. I am making a form to edit records in the database. I have no problem getting the form to pass the ID to the next page, but the field that is being edited simply won't pass. This may even be more of an HTML question, but in any case, I have tried for a while and simply can't find the answer.

    In the form call line I have: ...action=\"ReplaceDescription.php?ID=" . $ID . "&NewDesc=" . $newdesc . "\">\n");

    Then later on in the form, I have this: ...<textarea wrap=\"virtual\" cols=\"80\" rows=\"15\" name=\"$newdesc\">

    Like I said, I'm kind of new at this so there may be other things wrong that I'm not seeing - if you find something, please let me know. But what I am really in need of is a way to get the information from this textarea passed to the next page where it will be dealt with. I have tried MANY other combinations of things to get this to work, but it still isn't working. I'm sure it's actually a simple thing, but...

    Thanks very much in advance for any help you can give!!!
    Mark Wright
    Wrightsites.com - Better Hosting. Better Price.

  2. #2
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You shouldn't need to put the newdesc stuff in the action attribute.

    Because $newdesc should be passed on when you click Submit and it goes to the file you specified.

    Also, with the $id, why not just put that in a hidden field in the form. As you may as well not let your users see everything if they don't have to.

    <input type="hidden" name="id" />

    If you are getting the ID being passed on from another page, then add value=\"$id\" in it.

    Not sure if this will solve your problems, but look at the source in the form file, to see if the values are there or not. This is only if you want to see if variables are getting passed onto this page inparticular, as you won't be able to see anything you add into the textarea.

    But..

    you should be able to see the name attribute in the text area, ie: name=\"$newdesc\", make sure that the $newdesc is getting passed onto this page.

  3. #3
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Maybe it's because preceding this:

    ...action=\"ReplaceDescription.php?ID=" . $ID . "&NewDesc=" . $newdesc . "\">\n");

    you have:

    call(asp)enterC++code(a, b)vbScript(=good)JavaScript(=bad)..

    It's kind of ridiculous to ask people what's wrong with a line of code when you only post half the line. For instance, you have 7 quotes in the first line. Is there a matching quote in the first half of the line? Who knows? You have backslashes in what looks like plain html. Is one of the lines php code, or both? They look like php code, but maybe one or both are not between php tags. Don't be shy, post your code and make sure to include php tags around lines you consider php.
    Last edited by 7stud; Jun 6, 2001 at 02:39.

  4. #4
    SitePoint Enthusiast MarkW78's Avatar
    Join Date
    Mar 2001
    Location
    Wellington, Ohio
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Point Well Taken

    My Apologies. Here is the complete code for those lines:

    <?php

    echo("<form enctype=\"multipart/form-data\" method=\"post\" action=\"ReplaceDescription.php?ID=" . $ID . "&NewDesc=" . $newdesc . "\">\n");

    echo ("<TD align=\"left\" colspan=\"2\"><textarea wrap=\"virtual\" cols=\"80\" rows=\"15\" name=\"$newdesc\">$dbRow->Picture_Description</textarea></TD>\n");

    ?>

    When submitting the form with one of the records, the screen remains blank and the following is in the address bar:

    /gallery/admin/ReplaceDescription.php?ID=9&NewDesc=

    I've removed the domain name, but the rest of the URL is as shown in the address bar.
    Last edited by MarkW78; Jun 6, 2001 at 07:08.
    Mark Wright
    Wrightsites.com - Better Hosting. Better Price.

  5. #5
    SitePoint Enthusiast MarkW78's Avatar
    Join Date
    Mar 2001
    Location
    Wellington, Ohio
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fixed - Thanks for the help!

    I changed things around a bit and removed the newdesc part from the form action line. After that and one other small correction, things are working great. I'm still experimenting, but I'm glad I got it to work. Now, to move on to optimization...

    Thanks again!
    Mark Wright
    Wrightsites.com - Better Hosting. Better Price.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •