Jump to content

Mortier

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by Mortier

  1. If I understand you correctly you want to create something like this: <select name="submenu"> <option> - item1</option> <option> - item 1.1</option> <option> - item 1.2</option> <option> - item 1.3</option> <option> - item 1.3.1</option> <option> - item 1.3.2</option> <option> - item 2</option> <option> - item 2.1</option> </select> Or you don't want a select? Anyway what is important that your database saves your data as a way that it can be retrieved hierachialy. That means that you can have a database table with the following columns item_id item_name item_parent_id How you should save your data can be read here: MySQL Hierarchical data If this is what you are looking for (with the select thing), I'll tell you how you can retrieve this. If this is not what you meant then maybe make an simple example of what you want to achieve? Regards, Alex
  2. Oh damn you are right I now realize that the function was called from there and not from the image onClick event.. ai ai ai. Well thanks for your help, I'm glad it works
  3. Hello all, I have an very odd error in my code: function open_one(all_element, one_element, event_div) { alert(event_div) } <body onload="load_config(document.getElementById('all_items'), document.getElementById('one_item'), 'collapse'); return false"> <img id="collapse" src="img/img_left.png" onclick="open_one(document.getElementById('all_items'), document.getElementById('one_item'), 'collapse'); return false" alt="Uitklappen" /> <div id="all_items">Alle items</div> <div id="one_item">Één item</div> </body> The problem is that the alert (which I use for debugging) returns 'undefined'. While I give it the value 'collapse' in the function call. I tried everything but I don't know why it does not work. Tested in Firefox.
  4. Ok then i'll have to do like ?news={article_name} Well I don't have much choice I guess. Thanks for yuor help.
  5. Hello people! I'm trying to make an .htaccess RewriteRule with an id-name association. For instance you have an URL like this: [code] http://www.example.com/{news_article}.html [/code] and you want it to point to: [code] http://www.example.com/index.php?news={article_id} [/code] Any idea how I should realize this because {news_article} != {article_id}. The {news_article} can be looked up in an MySQL table using PHP but how should I integrate that here? Or is there another way? Thanks in advance, Mortier
  6. It looks nice with nice functions like image info ;)
  7. Maybe this is what you need: http://nl2.php.net/manual/en/features.remote-files.php So including external files is not always allowed, but when it is do the following: [code] <? include("http://www.webaddress.com"); ?> [/code] But it's usually disabled so I'm not sure.
  8. This code doesn't make any sense to me, I think we need more sufficient code too solve this problem :) SQL query could be a problem. And I do not see any in this code.
  9. Hello people! I have just started using TemplatePower as a templating engine for my website. But I have come to the following problem: how do I apply my selectmanipulation() function? [code] <? // als $data_type == 1, moet het resultaat met een while worden opgehaald // als $data_type == 0, gebruiken we de data als array // $data_name == veldnaam // $data == array of sql query // $set is array met veldwaarden // $css is stylenaam function ManipulateSelect($data_type, $data_name, $data, $set, $css) { echo '<select name="' . $data_name . '" class="' . $css .'">'; if($data_type == 1) //while { //$data == mysql query $result = mysql_query($data); while($list_data = mysql_fetch_assoc($result)) { echo $list_data['id']; if($list_data['id'] == $set[$data_name]) { $selected[$data_name] = 'selected'; } else { $selected[$data_name] = ''; } echo '<option value="' . $list_data['id'] . '" ' . $selected[$data_name] . '>' . htmlspecialchars($list_data['name']) . '</option>'; } } else //array met foreach { foreach($data as $id => $value) { if($id == $set[$data_name]) { $selected[$data_name] = 'selected'; } else { $selected[$data_name] = ''; } echo '<option value="' . $id . '" ' . $selected[$data_name] . '>' . $value . '</option>'; } } echo '</select>'; } ?> [/code] That's my function. It works perfect without templates ( it makes the option selected which is selected according to POST or SQL. Any ways of making it compitable with my TemplatePower?? Thanks for your help in advance, Alex
  10. Hello people, I use the following program to make smilies-images out of shortcuts like :) and :P. [code]<? function makeSmiley($content) { //bij het toevoegen van een smiley, let wel dat de eerste smiley 0.gif (of 0.jpg) wordt. $smilies = array ( "", //0 ":)", //1 ":P", //etc ":D", ":(", ";)", ":S", ":'(", ":@", ); //$replace = de key //$smiley = de waarde, bijv. :) foreach($smilies as $id => $smiley) { $replace = '<img src="img/smileys/' . $id . '.gif" alt="' . $smiley . '" />'; $content = str_replace($smiley, $replace, $content); //Search, Replace, Content } return $content; }?> [/code] Unfortunately I can't get it to make :p into an image because it only recognizes the capitalized P.. I've tried everything changing the replace thing do both (strtolower etc..) But it just won't work... I can't use PHP 5 functions btw.
  11. I don't really see what you exactly mean but I've been trying: To use the copy function which gives the same error. I've checked the manual for move_uploaded_file() and in the Dutch manual @ http://nl3.php.net/manual/nl/function.move-uploaded-file.php There's the following statement: [i]Opmerking: Als safe-mode aan staat, zal PHP kijken of de bestanden of directories waarmee je wilt werken dezelfde UID heeft als het script dat wordt uitgevoerd.[/i] I can not find this sentence in the English manual, weirdly. Translation is: [i]Note: If safe-mode is turned ON, PHP will check if the file or directories you choose to work with have the same UID as the executing script[/i] This sentence describes the problem perfectly, but does not come with a solution. But I don't get it because you say: [i]move_uploaded_file() is not affected by the [b]normal[/b] safe mode UID-restrictions[/i] This situation is then not a 'normal' one I suppose. Thanks for your help, though I haven't found a solution yet.
  12. Hello people! I'm experiencing some problems with my upload script. I have written my own upload script and it uploads to a directory made in that same script. The problem is that due to the SAFE MODE the upload fails. When I set the permission of the directory to 777 it still doesn't work. I think it has to do with the GID & UID because the directory is Apache and the script-owner is me (ftp account). I can not alter any settings because I use a webhost. [b]This is the error:[/b] Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 558 is not allowed to access /home/ivograsman/domains/ivograsman.nl/public_html/ogp/img/artikelen/2 owned by uid 101 in /home/ivograsman/domains/ivograsman.nl/public_html/ogp/test.php on line 14 [b]There are no $_FILES errors.[/b] Hope you people can help me! Greetings, Alex
  13. Hello The topic title says it already, is there an way I can strip off all the numeric charcaters? I can't find it. So that : 'blabla78'; would become : 'blabla'; Thanks in advance!
  14. Sorry but I don't quite understand what you want to do
  15. [!--quoteo(post=368919:date=Apr 26 2006, 07:47 PM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Apr 26 2006, 07:47 PM) [snapback]368919[/snapback][/div][div class=\'quotemain\'][!--quotec--] Not read your post fully - it's too big for me!!! A suggestion..... Why not have a checkbox beside each item in yur form instaed of a submit button. Then at the bottom o fthe form a method of selecting an action (edit, delete etc.) like set of radio buttons or a select box. That way you can use just one submit button and do alot more like deleting multiple items.... [/quote] Ok so with POST or GET, it has to be GET because how will I else keep the information set?
  16. Yes that's not an bad idea I'm going to think about that. Thanks ;)
  17. ok here's an overview. The main form which is the default-case is the actual problem because it's so messy and unlogical. [code] <? //structure of news.php switch($_GET['func']) {     default:     //form with all news + buttons          //delete function with checkboxes, must be in this case because it has to be in the while-loop          //add news at current working state also in the default mode, this works but its very messy. (many if-messing as you see above)     break;          case 'readnews';     //works all fine     break;          case 'etc..etc..';               } ?> [/code]
  18. Sure Here's the sourcecode of the add news form: ( which i include) [code] <? echo ' <form enctype="multipart/form-data" method="post" action=""> <table width="302" border="0">   <tr>     <th width="72" scope="col"><div align="left">Onderwerp</div></th>     <th width="220" scope="col"><div align="left">       <input type="text" name="subject" class="form" value="' . $_POST['subject'] . '">' . $errornotify1   . '     </div></th>   </tr>   <tr>     <th scope="row" valign="top"><div align="left">Inhoud</div></th>     <td>       <textarea name="content" cols="40" rows="20" class="text_area">' . $_POST['content'] . '</textarea>' . $errornotify2 . '     </td>   </tr>   <tr>     <th scope="row"><div align="left">Onderdeel</div></th>     <td><select class="select" name="section">     <option value="wwd">World Wide Domination</option>     <option value="gtae">Grand Theft Auto Experts</option>     <option value="both">Beiden</option>     </select></td>   </tr>   <tr>     <th scope="row"><div align="left">Foto</div></th>     <input type="hidden" name="MAX_FILE_SIZE" value="2000000"  />     <td><input type="file" name="graphic" value="' . $_POST['graphic'] . '"></td>        </tr>   <tr>     <th scope="row"><div align="left"><input class="button2" type="submit" name="previewnews" value="Voorbeeld"></div></th>     <td><input type="submit" class="button2" name="addnews2" value="Submit"></td>   </tr> </table> </form> ' . $subjecterror . '<br> ' . $contenterror . '<br> ' . $fileerror . ' '; ?> [/code] And the main script: [code] <? function getNewsUser() {     $select_news = "SELECT id, author, subject, content, section, graphic, date_format(date, '%d-%m-%Y %H:%i') AS dateNL  FROM gtae_news WHERE id='" . $_GET['news'] . "'";     $execute_news = mysql_query($select_news);     global $fetch_news;     $fetch_news = mysql_fetch_assoc($execute_news);     $select_user = mysql_query('SELECT id,nickname FROM gtae_members WHERE id="' . $_SESSION['id'] . '"');     global $fetch_user;     $fetch_user = mysql_fetch_assoc($select_user);     return; } //laatste keer bijgewerkt op 16 april 2006 setlocale(LC_TIME, 'nl_NL'); $date=date('Y-m-d H:i:s'); //nieuws met switch! $preview_date = date('d-m-Y H:s'); //datum van post bij preview, wordt niet opgeslagen require_once("verify.php"); if($gtae_rights == 1) {     switch($_GET['func'])     {         default:                           echo 'Here you can manage all the news that has been posted.<br>';         $select_news =  "SELECT id, author, subject, content, section, graphic, date_format(date, '%d-%m-%Y %H:%i') AS dateNL  FROM gtae_news ORDER BY id DESC";         $execute_news = mysql_query($select_news);         echo '<form method="get" action=""><table>         <tr>          <td><strong>Subject</strong></td>          <td><strong>Author</strong</td>          <td><strong>Date</strong</td>          <td><strong>Delete</strong></td>         </tr> ';           while($fetch_news=mysql_fetch_assoc($execute_news))           {             if($_GET['func'] == 'SelectAll')             {             $checked = 'checked';             $select = 'DeSelect';             $select_name = 'De-select';             }             else             {             $checked = '';             $select = 'SelectAll';             $select_name = 'Select all';             }                                                               // gegevens verzamelen over de author omdat we ID nodig heben voor het doorsturen naar zijn profiel           $author_id = mysql_query("SELECT id FROM gtae_members WHERE nickname='" . $fetch_news['author'] . "'");           $fetch_author_id = mysql_fetch_assoc($author_id);           echo '           <tr>                      <td><a href="?page=19&amp;func=readnews&amp;news=' . $fetch_news['id'] . '">' . $fetch_news['subject'] . '</a></td>           <td><a href="?page=15&amp;profile=' . $fetch_author_id['id'] . '">' . $fetch_news['author'] . '</a></td>           <td>' . $fetch_news['dateNL'] . '</td>           <td><input type="checkbox" name="delete" value="' . $fetch_news['id'] . '" ' . $checked . '></td>           </tr>';                                     if($_GET['func'] == DeleteMany)             {             $delete_query = 'DELETE FROM gtae_news WHERE id="' . $_GET['delete'] . '"';             //$delete = mysql_query($delete_query);             echo '' . $delete_query . '<br>';             //echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0; URL=?page=19\">";             }                                                               }                        echo '           <tr>           <td><a href="?page=19&amp;func=' . $select . '">' . $select_name . '</a></td>           <td><a href="?page=19&amp;func=DeleteMany">Delete</a></td>           <td><input type="submit" name="addnews" value="Add news" /></td>           </tr>         </table></form>';              if(isset($_GET['addnews']))       {          if(isset($_POST['confirm_news']))          {                       $goed = 1;                    //formulier gegevens verwerken               $subject = $_POST['subject'];               $content = $_POST['content'];                        if($content == "" OR $subject == "")               {               $goed = 0;                  if($content == "")                 {                 $errornotify2 = '**';                 $contenterror = "**&amp;nbsp;&amp;nbsp;No news without content.";                 }                 if($subject == "")                 {                 $errornotify1 = '*';                 $subjecterror = "*&amp;nbsp;&amp;nbsp;A title is needed to complete your news article.";                 }                 require_once("add_news.php");               }                        if($goed == 1)               {               $subject = strip_tags($subject);               $subject = htmlspecialchars($subject);               $content = strip_tags($content);               $content = htmlspecialchars($content);               $content = nl2br($content);                              require_once($_SERVER['DOCUMENT_ROOT'] . '/wwd/11/account/controlpanel/which_background.php');                              getNewsUser();                              require_once($_SERVER['DOCUMENT_ROOT'] . '/10/account/other/fetch_account.php');               mysql_query("INSERT INTO gtae_news (author, subject, content, section, date, bg) VALUES ( '" . $fetch_user['nickname'] . "', '" . $subject . "', '" . $content . "', '" . $_POST['section'] . "', '" . $date . "', '" . $bg . "')");                echo 'News has been added.';               echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"1; URL=?page=19\">";               }            }            else            {            require_once("add_news.php");            }                             if(isset($_POST['previewnews']))             {         require_once("bbcode.php");         getNewsUser();                           $content = nl2br($content);         $content = stripslashes($content);         echo '         <table width="400" border="0" align="center" cellpadding="0" cellspacing="0" style="border-left: 1px solid #000000; border-right: 1px solid #000000;">           <tr>                <td width="250" height="25" style="padding-left: 10px;" background="img/pages/home/bg_news.jpg"><strong>Title: </strong>' . $_POST['subject'] . '</td>                <td width="150" align="right" style="padding-right: 10px;" background="img/pages/home/bg_news.jpg"><strong>Date: </strong>' . $preview_date . '</td>             </tr>            <tr>                <td colspan="2" align="justify" background="img/bg.jpg" style="padding-right: 10px; padding-left: 5px;">' . $content . '</td>           </tr>           <tr>             <td height="20" colspan="2" align="right" bgcolor="#242424" style="padding-right: 10px; border-bottom: 1px solid #000000; border-top: 1px solid #000000;"><strong>Posted by: </strong>' . $fetch_user['nickname'] . '</td>            </tr>                </table>';          $_POST['content'] = stripslashes($_POST['content']);          $_POST['subject'] = stripslashes($_POST['subject']);          require_once("add_news.php");           }       }                             break;                                                      case "readnews":                  $content = $fetch_news['content'];         require_once("bbcode.php");                           //laat het bericht zien.              echo'         <table width="400" border="0" align="center" cellpadding="0" cellspacing="0" style="border-left: 1px solid #000000; border-right: 1px solid #000000;">           <tr>            <td width="250" height="25" style="padding-left: 10px;" background="img/pages/home/bg_news.jpg"><strong>Title: </strong>' . $fetch_news['subject'] . '</td>            <td width="150" align="right" style="padding-right: 10px;" background="img/pages/home/bg_news.jpg"><strong>Date:</strong> ' . $fetch_news['dateNL'] . '</td>           </tr>           <tr>            <td colspan="2" align="justify" background="img/bg.jpg" style="padding-right: 10px; padding-left: 5px;">' . $content . '</td>            </tr>            <tr>               <td height="20" colspan="2" align="right" bgcolor="#242424" style="padding-right: 10px; border-bottom: 1px solid #000000; border-top: 1px solid #000000;"><strong>Posted by: </strong>' . $fetch_news['author'] . '</td>             </tr>         </table>';         require_once("news_include_buttons.php");         break;                                                               case "delete":         $select_news = "SELECT * FROM gtae_news WHERE id='" . $_GET['news'] . "'";              $execute_news = mysql_query($select_news);              $fetch_news = mysql_fetch_assoc($execute_news);              echo 'Are you sure you wish to delete news item ' . $fetch_news['subject'] . '?<br>         <table>          <tr>           <td><form method="post" action=?page=19&amp;news=' . $fetch_news['id'] . '&amp;func=completedelete><input class="button" type="submit" name="yes" value="Yes"></form></td>           <td><form method="post" action=?page=19><input class="button"  type="submit" name="no" value="No"></form></td>          </tr>         </table>         ';         break;                                    case "completedelete":         $select_news = "SELECT * FROM gtae_news WHERE id='" . $_GET['news'] . "'";              $execute_news = mysql_query($select_news);              $fetch_news = mysql_fetch_assoc($execute_news);              mysql_query("DELETE FROM gtae_news WHERE id='" . $_GET['news'] . "'");         echo 'The message has been deleted.';         echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"1; URL=?page=19\">";         break;                  case "massivedelete":                                             case "edit":         $select_news = "SELECT * FROM gtae_news WHERE id='" . $_GET['news'] . "'";                  $execute_news = mysql_query($select_news);              $fetch_news = mysql_fetch_assoc($execute_news);              //een formuliertje waarin alle gegevens van het nieuws bericht staan                       if(isset($_POST['editnews']))         {         $goed = 1;             if($_POST['subject'] == "" OR $_POST['content'] == "" OR $_POST['subject'] == "You must enter a title." OR $_POST['content'] == "You must enter some content.")              {                 $goed = 0;                  if($_POST['subject'] == "" OR $_POST['subject'] == "You must enter a title." )                 {                 $subject = "You must enter a title.";                 }                 if($_POST['content'] == "" OR $_POST['content'] == "You must enter some content.")                 {                 $content = "You must enter some content.";                 }                 require_once("edit_news.php");             }                               if($goed == 1)             {             //nieuws bijwerken             $subject = strip_tags($_POST['subject']);             $subject = htmlspecialchars($subject);             $content = strip_tags($_POST['content']);             $content = htmlspecialchars($content);             $content = nl2br($content);             //$content = stripslashes($content);             $updatenews = "UPDATE gtae_news SET subject='" . $subject . "', content='" . $content . "', section='" . $_POST['section'] . "' WHERE id='" . $_GET['news'] . "'";             echo 'News has been edited.';             echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"1; URL=?page=19\">";             mysql_query($updatenews) or die(mysql_error());             }         }         elseif((!isset($_POST['previewedit']))) //er mag ook niet op preview geklikt zijn, daar krijgen we alleen maar rommel van!         {         require_once("edit_news.php");         }                  if(isset($_POST['previewedit']))         {                  getNewsUser();                  require_once("bbcode.php");         $content = nl2br($content);         $content = stripslashes($content);         echo '<table width="400" border="0" align="center" cellpadding="0" cellspacing="0" style="border-left: 1px solid #000000; border-right: 1px solid #000000;">         <tr>         <td width="250" height="25" style="padding-left: 10px;" background="img/pages/home/bg_news.jpg"><strong>Title: </strong>' . $_POST['subject'] . '</td>         <td width="150" align="right" style="padding-right: 10px;" background="img/pages/home/bg_news.jpg"><strong>Date: </strong>' . $date . '</td>       </tr>       <tr>         <td colspan="2" align="justify" background="img/bg.jpg" style="padding-right: 10px; padding-left: 5px;">' . $content . '</td>       </tr>       <tr>         <td height="20" colspan="2" align="right" bgcolor="#242424" style="padding-right: 10px; border-bottom: 1px solid #000000; border-top: 1px solid #000000;"><strong>Posted by: </strong>' . $fetch_user['nickname'] . '</td>       </tr>            </table>';          //we selecteren opniew de gegevens omdat we anders problemen krijgen met een oud add news formuliertje waarvan de gegevens na preview niet bijgewerkt worden         $select_news = "SELECT * FROM gtae_news WHERE id='" . $_GET['news'] . "'";                  $execute_news = mysql_query($select_news);              $fetch_news = mysql_fetch_assoc($execute_news);                  $fetch_news['content'] = stripslashes($fetch_news['content']);         require_once("edit_news.php");           }                  break;              } } else { require_once($_SERVER['DOCUMENT_ROOT'] . '/10/no_acces.php'); } [/code] Well you probably find this quite a mess and im busy optimalizing it too but I will need the best structure first. As you see I use switch, A GET switch because else you would get weird buttons (becuase it checks the button value and u usually make buttons called like Submit and you need them al to be unique using POST switch). It quite works this way, the current code is experimental and that with the double isset POSt doesnt work ofcourse, I used to do that as a different case but then I cant use buttons anymore in the form?? AAH very confusing that's why I want to alter my structure :) EDIT: I will post a structure of my current script in a few min because this isnt really getting better, too many irrelevent coding :)
  19. Well you could store images in the database (to start with the last). I suppose you use a MySQL database so I'm going to write an example script here First your database: name the TABLE albums, for example use the following colums: - id (make sure it does auto-increment and it must be unique) - name (album name) - track1(number of tracks in album) - track2 - track3 - add as many track colums as you need - albumcover (name of the album e.g. albumcover.jpg) You can always add more data types. Then we go to the PHP script. [code] <? //connect to mysql and your mysql database first before you do this $select_albums = mysql_query('SELECT * FROM albums'); //get info from database //we use a while loop, because else only 1 recorder (meaning 1 album can be displayed, this way we'll get them all) while($album = mysql_fetch_assoc($select_albums)) { //here we make a list of all albums, everything within the while will be repeated so be aware of that when adding styles etc echo '<a href="mypage.com?action=ViewAlbum&id=' . $album['id] . '">' . $album['name'] . '</a>'; } if($_GET['action'] == ViewAlbum) { $select_album = mysql_query('SELECT * FROM albums WHERE id="' . $_GET['id'] . '"'); //locates the id from the url so mysql knows which album to select $album = mysql_fetch_assoc($select_album); // no while needed because we only view info of 1 album at once echo '<img src="images/' . $album['albumcover'] . '"><br>'; echo $album['name']; } [/code] well I've tried to keep it short but this is how your simplified system could look like. I hope you use MySQL as database, would be the easiest. If you have any questions, ask them. Don't really know how to estimate your knowledge of PHP (and MySQL?) but I hope this makes sense :) Good luck
  20. Well I can't really understand what your script does but there's a proper way to echo HTML and variables you have: [code] echo "<INPUT TYPE=hidden name=vc value=$_POST[vc]>\n"; [/code] try changing it into: [code] echo "<input type='hidden' name='vc' value='" . $_POST['vc'] . "'>\n"; [/code] Im not sure if this will fix your problem but this way you kind of break out of the echo which is better for variabeles I believe. I've had problems with that. if it doesnt work -> Explain a bit what your code does (use comments) and what is actually done (information is inserted using a form)
  21. Yes, I think the best way is using a database, like MySQL. If you have this on your website/server you're fine with that I suppose you have no experience with that; Then you can use 1 page ( And that would list e.g. all albums (I think u mean this:) and once u click on an album you'll get more detailed info. PHP can make a script (which can be like 50 lines) that will list all the albums using the (MySQL)database. Then you can give each album a link (you only have to do it once and php will do this for all of your database items== your albums) And each link will carry the unique ID of that album which will load the data as the tracks and the album cover. So that can be indeed, much and much more efficient -> if I understand you correctly.
  22. Yes post the query please because I can't quite understand what you're getting to. Are you calculating the time between 2 dates? And how many hours there's left?
  23. Replying to question 2: Well for the $_POST and $_GET thing, this is information send after the form. You probably get your data, the variabeles from a form: something like: [code] <? <form method="post" action="">   <table>      <tr>          <td><input type="text" name="first_name" ></td>          <td><input type="submit" name="submit" ></td>      </tr>   </table> </form> ?> [/code] Well the information a user entered in the input area 'first_name' is stored in a $_POST['first_name'] if the form-method is POST. As in my example. So POST is just form data. People use that in their example because you want to e-mail form information. GET is quite the same in use(apart from that it uses the URL to send info), there's loads of info on it. Reply on question 3: Doesn't matter for your script but sometimes you can understand your code better if you split it up in several parts. I don't think I can answer your first question , I'm not that good in PHP myself, sorry Well hope this helps
  24. Hello guys!! I'm currently working out my control panel and I'm having a problem with my forms. The news-admin section begins with an overview of all the news that has been posted and the ability to remove the selected news items, as you often see in PM boxes. This function requires buttons to work - which means I'll need to do $_POST, because $_GET wouldn't do any good to my url which is like www.page.com?page=34&mode=5 So I use $_POST to check what the user wants to do, e.g. he wants to add news. Well then he clicks the button and the script loads the add news page (using if(isset($_POST['button'])) ) But the add news form has also got an form, which also uses $_POST. then the script structure would look like this: [code] if(isset($_POST['add_news])) //the button the user clicked on in the main menu {      if(isset($_POST['confirm_news']) //the button the user clicked on in the add news section after typing the message      {       //validating and processing form      }      else      {      //load the add - news form       } } [/code] As you guys know this structure doesnt work - > after clicking the first button everything is fine, it will load the add -news form because you havent clicked the confirm news button yet, but once u finished writing the article you click the confirm news button , validating should start then, But it does not because the first button is no longer set and you will leave both if-statements immidiatly. For those who can understand my bad problem-explanation skills; Any suggestions ??
×
×
  • 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.