Results 1 to 4 of 4

Thread: Post issues

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2009
    Location
    Victoria, Australia
    Posts
    17

    Post issues

    Hi,
    I've currently got the following code:

    PHP Code:
            echo "<form name=\"AdminStuff\" action=\"newPost.php\" method=\"POST\">\n";
            echo 
    "<div class=\"hr\"> <hr /> </div>\n";
            echo 
    "<h1>" $heading "</h1>\n";
            echo 
    "<p>" $content "</p>\n";
            echo 
    "<span class=\"postinfo\"> Posted by " $poster " on " $date "\n";

            echo 
    "<input type=\"hidden\" name=\"heading\" value=\"$heading\">\n";
            echo 
    "<input type=\"hidden\" name=\"content\" value=\"$content\">\n";
            echo 
    "<input type=\"hidden\" name=\"postID\" value=\"$postID\">\n";
            echo 
    "  &nbsp;&nbsp;[ <a href=\"newPost.php\" onClick=\"AdminStuff.submit(); return false;\">Edit</a>\n";
            echo 
    " | <a href=\"removePost.php\" onClick=\"AdminStuff.submit(); return false;\">Remove</a> ]\n";
            echo 
    "</span>\n";        
            echo 
    "</form>\n"
    Right now, this generates the HTML as expected.. with the three hidden fields with the right information.
    However, in newPost.php, the $_POST array is empty.

    The code for newPost.php is as follows:
    PHP Code:
            echo "<form method=\"post\" action=\"generatePost.php\" action=\"POST\">";
            echo 
    "<textarea name=\"heading\" cols=\"40\" rows=\"1\">";
            echo 
    $_POST['heading'];
            echo 
    "</textarea><br>";
            echo 
    "<textarea name=\"body\" cols=\"40\" rows=\"5\">";
            echo 
    $_POST['content'];
            echo 
    "</textarea><br>";
            echo 
    "<input type=\"submit\" value=\"Submit\" />";
            echo 
    "<input type=\"hidden\" value=\"" $_POST['postID'] . "\">";
            echo 
    "</form>"
    Any ideas? If there's any easier way, please let me know. I need the link to be a hyperlink, and to send the data with POST (not GET).

    Thanks
    -Rob

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Post issues

    Hi,

    Try putting both the html and the php in the one file and see if that helps!
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Post issues

    you do not need to do what Nightwalker83 suggested.

    you're technically submitting your form via a link, and so if your browser is just going to newPost.php instead of submitting to it, this would be your problem. just use a submit button.

    HTML Code:
    <input type="submit" name="edit" value="Edit" />
    <input type="submit" name="remove" value="Remove" />
    you could check if $_POST['edit'] or $_POST['remove'] exist and then either edit or remove the post accordingly.

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Post issues

    double post an hour later, somehow. whoops. delete this?

Posting Permissions

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



Click Here to Expand Forum to Full Width