Probleem met wysiwyg-editor op tekstveld

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Durnez

durnez

19/07/2007 17:56:00
Quote Anchor link
Hallo,

Ik ben bezig aan een cms en heb al direct a lot of problems :p

Op http://durnez.du.ohost.de/flash_news/admin.php kan u zelf ondervinden wat het probleem is.

Er staat dus wel degelijk info in de database maar deze is niet zichtbaar in het veld. Soms gebeurt dat wel, soms niet.. erg vaag dus
Als de tekst er dan wel staat gaat deze dan opnieuw weg na het aanbrengen van de aanpassingen..

De wysiwyg-editor komt van http://www.openwebware.com/products/openwysiwyg

Hieronder de code van hetgeen waar het probleem zou moeten zitten :

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
#***********************
#  ADD NEWS ENTRY
#***********************


echo '<script language="JavaScript" type="text/javascript" src="/flash_news/wysiwyg.js"></script>';

//Check to make sure nobody attempts to access file directly
if(!defined('FLASH_NEWS')){
    
    echo 'You do not have permission to access this file';
    exit;
}


    
$author = (isset($_POST['author'])) ? addslashes2($_POST['author']) : '';
$title  = (isset($_POST['title']))  ? addslashes2($_POST['title'])  : '';
$body   = (isset($_POST['body']))   ? addslashes2($_POST['body'])   : '';


//ADD NEWS ENTRY
if($mode != '' && $action === 'add_news'){
    
    //Did they fill in everything?
     if($author != '' && $title != '' && $body != ''){
         
         //YES
    
        $query = "INSERT INTO flash_news (author, title, body, timestamp)  
                            VALUES('"
. $author . "', '" . $title . "', '" . $body . "', '" . time() . "')";
        
        if(mysql_query($query)){
            
             echo '<p style="text-align:middle;">News Added!</p>';
            
        }
else{
            
            echo 'Problem Executing Query' . mysql_error();
            
        }
        
     }
else{
         
         //NO
          echo 'Please Fill in all fields!';
         
     }

    
//RETRIEVE INFO FOR EDIT NEWS ENTRY    
}elseif($mode === 'edit'){
    
    if($action == ''){
    
         $query = 'SELECT id, author, title , body
                             FROM flash_news
                             WHERE id='
. $id . '';
         $result = mysql_query($query);
         
          $r = mysql_fetch_row($result);
         
         $id            = $r[0];
         $author = stripslashes2($r[1]);
         $title    = stripslashes2($r[2]);
         $body   = stripslashes2($r[3]);
    
    }
else{
        
        //DO THE EDIT AND SEND INFO TO THE DATABASE
        if($action === 'edit_news'){
            
        $query = 'UPDATE flash_news  
                            SET author="'
. $author . '", title="' . $title . '", body="' . $body . '"  
                            WHERE id =" '
. $id . '"';
        
            if(mysql_query($query)){
            
                echo 'Update Sucessful!';
            
            }
else{
            
                echo 'Could not update News..' . mysql_error();
            
        }
        
    }
    

    }
}

?>

<div style="margin-top: 150px;">
<table style="margin: 0 auto;width:500px;top:50px;border:1px dotted #E5E5E5;" cellspacing="1">
    <tr class="dark">
    <td><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">Author</td>
    <td><input type="text" name="author" value="<?php echo $author; ?>" style="width: 120px;" /></td>
    </tr>
    <tr class="light">
    <td>Title</td>
    <td><input type="text" name="title" value="<?php echo $title; ?>" style="width: 120px;" /></td>
    </tr>
    <tr class="dark">
    <td>Body:</td>
    <td><textarea id="body" cols="40" rows="10"><?php echo $body; ?></textarea>
    <script language="JavaScript">
      generate_wysiwyg('body');
    </script></td>
    </tr>
    <tr class="light">
    <td colspan="2">
        <input type="hidden" value="<?php echo $mode; ?>" name="mode" />
        <input type="hidden" value="<?php echo $id; ?>" name="id" />
        <input type="hidden" value="<?php echo ($mode == 'add' ? 'add_news' : 'edit_news'); ?>" name="action" />
        <input type="submit" value="Submit" name="submit" class="button" />
    </td>
    </tr>
        </form>
</table>
</div>


Alvast bedankt voor de hulp !
Gewijzigd op 01/01/1970 01:00:00 door Durnez
 
PHP hulp

PHP hulp

29/03/2024 12:16:20
 
Aaa Trump

aaa Trump

19/07/2007 18:15:00
Quote Anchor link
Dat gratis op je mobiel ding?
 
Durnez

durnez

19/07/2007 23:46:00
Quote Anchor link
Waar slaat dat in godsnaam op ??
Als je iets post, zorg dan tenminste dat ik er mee vooruit geholpen ben...
 



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.