Jump to content

Help Debug This Form...


mem0ri

Recommended Posts

EDIT: SOLVED

Been sittin' for ages tryin' to figure out what's wrong...

...page comes up...but when the "submit" button is pressed, nothing happens...nothing at all...Funny thing is, it all worked fine until I cut and paste the HTML into PHP.

[code]

<?php
    require("MySQLQueries.php");
    require("FormsandHeaders.php");
    include("FCKeditor/fckeditor.php");
    
    $edited = @$_POST['Submit'];
    $toedit = @$_GET['edit'];
    $pagename = "PageAdmin.php";
    
    $header = getHeader();
    echo($header);
?>
<table align="center" width="780"><tr>
<td>
    <?php
        $menu = getMenu();
        echo($menu);
    ?>
</td>
<td align="right">
    
    <?php
        if($toedit)
        {
            echo("<form action=\"PageAdmin.php\" method=\"post\">");
            $retrieved = fetchSingle("content","$pagename","page","db");
            $retrieved = $retrieved['text'];
            $oFCKeditor = new FCKeditor('PageEntry');
            $oFCKeditor->BasePath = '/FCKeditor/';
            $oFCKeditor->Value = $retrieved;
            $editor = $oFCKeditor->Create();
            echo("<input name=\"Submit\" type=\"button\" value=\"Submit Page\"></form>");
        }
        else if($edited)
        {
            $author = "Admin";
            $update = editValue("content","text,author","'$edited','$author'","page = '$pagename'","schaeffer");
            echo($update);
        }
        else
        {
            $retrieved = fetchSingle("content","$pagename","page","db");
            $retrieved = $retrieved['text'];
            
            $form1="<table><tr><td>";
            $form1.=$retrieved;
            $form1.="</td></tr>";
            $form1.="<tr><td align=\"right\"><a href=\"$pagename?edit=yes\">Edit</td></tr>";
            $form1.="</table>";
            echo($form1);
        }
    ?>

[/code]
Link to comment
Share on other sites

[code]            $form1="<table><tr><td>";
            $form1.=$retrieved;
            $form1.="</td></tr>";
            $form1.="<tr><td align=\"right\"><a href=\"$pagename?edit=yes\">Edit</td></tr>";
            $form1.="</table>";[/code]

Unless I'm crazy, which I wouldnt doubt that I am, if you define a variable multiple times and then echo it, it will echo the most recent definition...

So try something like

[code]
$form1="<table><tr><td>". $retrieved . "</td></tr><tr><td align=\"right\"><a href=\"" . $pagename . "?edit=yes\">Edit</td></tr></table>";
[/code]

Also, I'm not sure, but I've never seen echo (something) used before... Maybe try echo $form1;
Link to comment
Share on other sites

[!--quoteo(post=352748:date=Mar 7 2006, 10:18 PM:name=Corbin)--][div class=\'quotetop\']QUOTE(Corbin @ Mar 7 2006, 10:18 PM) [snapback]352748[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Unless I'm crazy, which I wouldnt doubt that I am, if you define a variable multiple times and then echo it, it will echo the most recent definition...
[/quote]

Thats not redefinition, its concatenation. Notice the .=? Its like saying $form = $form . "string";

The problem is actually in your html, not your php. A submit button isnt of type button, its of type submit.
<input type="Submit" name="Submit" />
Link to comment
Share on other sites

Ouch...talk about a simple overlook...thank you so much greycap! I would have stared blankly at the code forever...hah.

And yes...greycap is also right that I'm doing concatenation with a "$form .=" ...it's a lot easier than doin' "$form = $form."
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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