Jump to content


Photo

Help Debug This Form...


  • Please log in to reply
3 replies to this topic

#1 mem0ri

mem0ri
  • Members
  • PipPipPip
  • Advanced Member
  • 110 posts

Posted 07 March 2006 - 10:58 PM

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.


<?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);
        }
    ?>



#2 corbin

corbin
  • Staff Alumni
  • Advanced Member
  • 8,129 posts

Posted 08 March 2006 - 04:18 AM

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

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

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

Also, I'm not sure, but I've never seen echo (something) used before... Maybe try echo $form1;
Why doesn't anyone ever say hi, hey, or whad up world?

#3 greycap

greycap
  • Members
  • PipPipPip
  • Advanced Member
  • 31 posts

Posted 08 March 2006 - 04:32 AM

[!--quoteo(post=352748:date=Mar 7 2006, 10:18 PM:name=Corbin)--][div class=\'quotetop\']QUOTE(Corbin @ Mar 7 2006, 10:18 PM) View Post[/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" />

#4 mem0ri

mem0ri
  • Members
  • PipPipPip
  • Advanced Member
  • 110 posts

Posted 08 March 2006 - 03:37 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users