Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Help! Coding

Asked Modified Viewed 1,843 times
W
wolf20
W
wolf20 10
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
asked
Newbie

Hello

I need a little help.
This is my code:
if (isset($_POST['saveinfo'])) {
    $szoveg = stripinput($_POST['szoveg']);   
   if ((isset($_GET['action']) && $_GET['action'] == "edit")  && (isset($_GET['info_id']) && isnum($_GET['info_id']))) {
      $result = dbquery("UPDATE ".DB_INFO." SET
         szoveg = '".$szoveg."'
         WHERE info_id='".$info_id."'");
      redirect(FUSION_SELF.$aidlink."&status=af&info_id=".$info_id);
   } else {
      $result = dbquery("INSERT INTO ".DB_INFO." SET szoveg = '".$szoveg."'");
      redirect(FUSION_SELF.$aidlink."&status=ah");    
    }
} else {
   if ((isset($_GET['action']) && $_GET['action'] == "edit")  && (isset($_GET['info_id']) && isnum($_GET['info_id']))) {
      $result = dbquery("SELECT * FROM ".DB_INFO." WHERE info_id='".$info_id."'");
      $data = dbarray($result);
      $szoveg = stripinput($data['szoveg']);
      $action = FUSION_SELF.$aidlink."&action=edit&info_id=".$info_id;
   } else {
      $szoveg = "";
      $action = FUSION_SELF.$aidlink;
   }
   opentable();
   echo "<form name='saveinfoform' method='post' action='$action'>\n";
      echo "<table class='tbl-border' cellpadding='0' cellspacing='1' width='100%' align='center' border='0'>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px;'>SZÖVEG:</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='width:500px;'><input type='text' name='szoveg' value='".$szoveg."'/>\n</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='center' colspan='2'><br />\n<input type='submit' name='saveinfo' value='MENTÉS' class='button' />\n</td>\n";
         echo "</tr>\n";
      echo "</table>\n";
   echo "</form>\n";
   closetable();
}

this should be an automatic text fields for example.: $szoveg : ".locale ['locale1']."
or something like that. just in case you do not have the frequency of certain fields.
Thus, if an empty field, then went to automatically fill in a predefined text

"Sorry for my bad English."
0 replies

9 posts

C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

You have status yet I do not see status set anywhere.
0 replies
W
wolf20
W
wolf20 10
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
answered
Newbie


$t1 ="";
$t2 ="";
$be ="";
$ho ="";
$mu ="";
$te ="";
$le ="";
if (isset($_POST['saveinfo'])) {
   $t1 = ($_POST['t1'] =="" ? $locale['admin_058'] : stripinput($_POST['t1']));
   $t2 = ($_POST['t2'] =="" ? $locale['admin_059'] : stripinput($_POST['t2']));
   $t3 = stripinput($_POST['t3']);
   $be = ($_POST['be'] =="" ? $locale['admin_060'] : stripinput($_POST['be']));
   $ho = ($_POST['ho'] =="" ? $locale['admin_061'] : stripinput($_POST['ho']));
   $ev = stripinput($_POST['ev']);
   $mu = ($_POST['mu'] =="" ? $locale['admin_062'] : stripinput($_POST['mu']));
   $te = ($_POST['te'] =="" ? $locale['admin_063'] : stripinput($_POST['te']));
   $le = ($_POST['le'] =="" ? $locale['admin_064'] : stripinput($_POST['le']));
   $ir = stripinput($_POST['ir']);   
   if ((isset($_GET['action']) && $_GET['action'] == "edit")  && (isset($_GET['nf_id']) && isnum($_GET['nf_id']))) {
      $result = dbquery("UPDATE ".DB_NF." SET
         t1 = '".$t1."',
         t2 = '".$t2."',
         t3 = '".$t3."',
         be = '".$be."',
         ho = '".$ho."',
         ev = '".$ev."',
         mu = '".$mu."',
         te = '".$te."',
         le = '".$le."',
         ir = '".$ir."'
         WHERE nf_id='".$nf_id."'");
      redirect(FUSION_SELF.$aidlink."&amp;status=af&amp;nf_id=".$nf_id);
   } else {
      $result = dbquery("INSERT INTO ".DB_NF." SET
         t1 = '".$t1."',
         t2 = '".$t2."',
         t3 = '".$t3."',
         be = '".$be."',
         ho = '".$ho."',
         ev = '".$ev."',
         mu = '".$mu."',
         te = '".$te."',
         le = '".$le."',
         ir = '".$ir."',
         da = '".time()."',
         la = '0'");
      redirect(FUSION_SELF.$aidlink."&amp;status=ah");    
    }
} else {
   if ((isset($_GET['action']) && $_GET['action'] == "edit")  && (isset($_GET['nf_id']) && isnum($_GET['nf_id']))) {
      $result = dbquery("SELECT * FROM ".DB_NF." WHERE nf_id='".$nf_id."'");
      $data = dbarray($result);
      $t1 = stripinput($data['t1']);
      $t2 = stripinput($data['t2']);
      $t3 = stripinput($data['t3']);
      $be = stripinput($data['be']);
      $ho = stripinput($data['ho']);
      $ev = stripinput($data['ev']);
      $mu = stripinput($data['mu']);
      $te = stripinput($data['te']);
      $le = stripinput($data['le']);
      $ir = stripinput($data['ir']);
      $action = FUSION_SELF.$aidlink."&amp;action=edit&amp;nf_id=".$nf_id;
   } else {
      $t1 = "";
      $t2 = "";
      $t3 = "";
      $be = "";
      $ho = "";
      $ev = "";
      $mu = "";
      $te = "";
      $le = "";
      $ir = $userdata['user_name'];
      $action = FUSION_SELF.$aidlink;
   }
   opentable($locale['admin_004']);
   echo "<form name='saveinfoform' method='post' action='$action'>\n";
      echo "<table class='tbl-border' cellpadding='0' cellspacing='1' width='100%' align='center' border='0'>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px;'>".$locale['admin_006']." <img src='".INFUSIONS."nf/image/info.png' style='vertical-align: middle;' width='14px' height='14px' alt='' title='".$locale['admin_007']."' /><strong>:</strong>".$locale['admin_005']."</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='500px'><input type='text' name='ir' value='".$ir."' class='textbox' style='width:500px;padding-left:2px;' />\n<br />\n</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px;'>".$locale['admin_008']." <img src='".INFUSIONS."nf/image/info.png' style='vertical-align: middle;' width='14px' height='14px' alt='' title='".$locale['admin_009']."' /><strong>:</strong>".$locale['admin_005']."</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='width:500px;'>";
               echo "<input type='text' name='t1' value='".$t1."' maxlength='1500' class='textbox' style='width:500px;padding-left:2px;' />\n";
            echo "</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px;'>".$locale['admin_010']." <img src='".INFUSIONS."nf/image/info.png' style='vertical-align: middle;' width='14px' height='14px' alt='' title='".$locale['admin_011']."' /><strong>:</strong>".$locale['admin_005']."</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='width:500px;'>";
               echo "<input type='text' name='t2' value='".$t2."' maxlength='2000' class='textbox' style='width:500px;padding-left:2px;'/>\n";
            echo "</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px;'>".$locale['admin_012']." <img src='".INFUSIONS."nf/image/info.png' style='vertical-align: middle;' width='14px' height='14px' alt='' title='".$locale['admin_013']."' /><strong>:</strong>".$locale['admin_005']."</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='width:500px;'>";
               echo "<input required='required' type='text' name='t3' value='".$t3)."' maxlength='500' class='textbox' style='width:500px;padding-left:2px;' />\n";
            echo "</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px;'>".$locale['admin_014']." <img src='".INFUSIONS."nf/image/info.png' style='vertical-align: middle;' width='14px' height='14px' alt='' title='".$locale['admin_015']."' /><strong>:</strong>".$locale['admin_005']."</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='width:500px;'>";
               echo "<input type='text' name='be' value='".$be."' maxlength='300' class='textbox' style='width:500px;padding-left:2px;' />\n";
            echo "</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px;'>".$locale['admin_016']." <img src='".INFUSIONS."nf/image/info.png' style='vertical-align: middle;' width='14px' height='14px' alt='' title='".$locale['admin_017']."' /><strong>:</strong>".$locale['admin_005']."</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='width:500px;'>";
               echo "<input type='text' name='ho' value='".$ho."' maxlength='500' class='textbox' style='width:500px;padding-left:2px;' />\n";
            echo "</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px;'>".$locale['admin_018']." <img src='".INFUSIONS."nf/image/info.png' style='vertical-align: middle;' width='14px' height='14px' alt='' title='".$locale['admin_019']."' /><strong>:</strong>".$locale['admin_005']."</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='width:500px;'>";
               echo "<input required='required' type='text' name='ev' value='".$ev)."' maxlength='20' class='textbox' style='width:500px;padding-left:2px;' />\n";
            echo "</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px;'>".$locale['admin_020']."<strong>:</strong>".$locale['admin_005']."</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='width:500px;'>";
               echo "<input type='text' name='mu' value='".$mu."' maxlength='4500' class='textbox' style='width:500px;padding-left:2px;' />\n";
            echo "</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px;'>".$locale['admin_021']."<strong>:</strong>".$locale['admin_005']."</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='width:500px;'>";
               echo "<input type='text' name='te' value='".$te."' maxlength='4500' class='textbox' style='width:500px;padding-left:2px;' />\n";
            echo "</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='right' class='tbl1 tbl-border' style='width:200px; vertical-align:text-top;'>".$locale['admin_022']."<strong>:</strong>".$locale['admin_005']."</td>\n";
            echo "<td align='left' class='tbl1 tbl-border' style='500px'><textarea name='le' cols='60' rows='5' class='textbox' style='width:500px;padding-left:2px;'>".$le."</textarea><br />\n";
            echo display_bbcodes("510px", "le", "saveinfoform", "b|i|u|url|img|center|quote|color|bcolor")."</td>\n";
            echo "</td>\n";
         echo "</tr>\n";
         echo "<tr>\n";
            echo "<td align='center' colspan='2'><br />\n";
               echo "<input type='submit' name='saveinfo' value='".$locale['admin_023']."' class='button' />\n";
            echo "</td>\n";
         echo "</tr>\n";
      echo "</table>\n";
   echo "</form>\n";
   closetable();
}


Merged on Mar 21 2014 at 14:19:16:
may be used for some other solution?
Edited by wolf20 on 21-03-2014 16:19,
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Can you show me your latest code please?
0 replies
W
wolf20
W
wolf20 10
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
answered
Newbie

one, two fields he goes.
But a total of seven, and so do not go I don't understand.
In theory of two of these go you should go to the field 7

eg.:
$szoveg1, $szoveg2 <- stop there he goes
$szoveg1, $szoveg2, $szoveg3, $szoveg4, $szoveg5, $szoveg6, $szoveg7 <- so do not go
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

What's the problem? Any Error logs?
0 replies
W
wolf20
W
wolf20 10
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
answered
Newbie

I'm sorry, I misspelled the code above, I see, so I've got too So the problem still exists
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

$szoveg = ($_POST['szoveg'] =="" ? $locale['szoveg'] : stripinput($_POST['szoveg']));
0 replies
W
wolf20
W
wolf20 10
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions
answered
Newbie

almost good.
so if I use good:
$szoveg = ($_POST['szoveg'] == "DEFAULT VALUE HERE IF EMPTY" stripinput ($_POST['szoveg']) "?");

but if so I use is not good (no saved):
$szoveg = (? $_POST['szoveg'] == "" $locale['szoveg']: stripinput ($_POST'szoveg']));
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Hey,

This is one way of testing.

Upload this file to your site root name it what you want.php

<?php
/*-------------------------------------------------------+
| PHPFusion index-content Management System
| Copyright (C) 2002 - 2013 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: test.php
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";

if (!iADMIN) { redirect(BASEDIR."index.php"); }


opentable("TEST");
$szoveg ="";

$szoveg = ($_POST['szoveg'] =="" ? "DEFAULT VALUE HERE IF EMPTY" : stripinput($_POST['szoveg']));

   if (isset($_POST['saveinfo'])) {
      echo $szoveg;
   }


   echo "<form name='saveinfoform' method='post' action='".FUSION_SELF."'>
   <input type='text' name='szoveg' value=''/>
   <input type='submit' name='saveinfo' value='MENTÉS' class='button' />
   </form>\n";
         
      
closetable();

require_once THEMES."templates/footer.php";

?>


Test That out and you will get the general idea.

If Nothing is entered it will print out DEFAULT VALUE HERE IF EMPTY else if you enter a value it will do as normal and print out that value.

This is just a basic solution but it gives you a general approach and also gives you a way to test things. Notice in the file only admins can access it change it to iSUPERADMIN if you want. Please also keep in mind not to test things on a production environment so to keep it all safe.

Good Luck hope that helps a bit.
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 9 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
W
W
wolf20 10
  • Newbie, joined since
  • Contributed 9 posts on the community forums.
  • Started 3 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet