Jump to content

indalecio

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Everything posted by indalecio

  1. This DOES use phpBB, but thats not the concern.  I am trying to get this If / Else statement to read the $problem variable, but for some reason it just doesn't to, and it moves onto the item creation.  I have tried this current setup, isset(), and !isset().  Any help is appreciated. [code]///////////// // Weapons // ///////////// if ( $_POST['equipment_type'] == 'weapon' ) { if ( isset($_POST['submit']) ) { if ( !isset($_POST['weapon_name']) ) { $problem = '1'; $problem_statement = 'Your weapon did not have a name<br>'; } if ( !isset($_POST['weapon_type']) ) { $problem = '1'; $problem_statement = $problem_statement . 'Your weapon did not have a type<br>'; } if ( !isset($_POST['weapon_job1']) ) { $problem = '1'; $problem_statement = $problem_statement . 'Your weapon did not have a class<br>'; } if ( !isset($_POST['weapon_job1']) && isset($_POST['weapon_job2']) ) { $problem = '1'; $problem_statement = $problem_statement . 'There was a problem with the classes you chose.<br>'; } if ( !isset($_POST['weapon_job1']) && !isset($_POST['weapon_job2']) && isset($_POST['weapon_job3']) ) { $problem = '1'; $problem_statement = $problem_statement . 'There was a problem with the classes you chose.<br>'; } if ( !isset($_POST['weapon_dmg_low']) && !isset($_POST['weapon_dmg_hi']) ) { $problem = '1'; $problem_statement = $problem_statement . 'Your weapon is missing a damage parameter.<br>'; } if ( !isset($_POST['weapon_lvl']) ) { $problem = '1'; $problem_statement = $problem_statement . 'Your weapon is missing the level parameter.<br>'; } if ( !isset($_POST['weapon_cost']) ) { $problem = '1'; $problem_statement = $problem_statement . 'Your weapon is missing the cost parameter.<br>'; } if ( !isset($_POST['weapon_weight']) ) { $_POST['weapon_weight'] = '0'; } if ( !isset($_POST['weapon_def']) ) { $_POST['weapon_def'] = '0'; } if ($problem == '1') { if ( $_POST['weapon_hands'] == '1' ) { $template->set_filenames(array( 'body' => 'admin/weapon_add_one.tpl') ); $template->assign_vars(array( 'PROBLEM_STATEMENT' => $problem_statement )         ); } elseif ( $_POST['weapon_hands'] == '2' ) { $template->set_filenames(array( 'body' => 'admin/weapon_add_two.tpl') ); $template->assign_vars(array( 'PROBLEM_STATEMENT' => $problem_statement )         ); } } else { /**************************** * Insert weapon to database * *****************************/ $update = DATABASE INFO if (!$update) { message_die(GENERAL_MESSAGE, 'Your weapon could not be added.' ); } $success = TRUE; } } else { /************************ * Go to Add weapon Page * *************************/ if ( $_POST['weapon_hands'] == '1' ) { $template->set_filenames(array( 'body' => 'admin/weapon_add_one.tpl' ) ); } elseif ( $_POST['weapon_hands'] == '2' ) { $template->set_filenames(array( 'body' => 'admin/weapon_add_two.tpl' ) ); } $template->assign_vars(array( 'FORM_ACTION' => append_sid("admin_equipment.$phpEx") )         ); } [/code]
  2. [code]$result = mysql_query("SELECT * FROM joa WHERE keyword LIKE '%$keyword%' >>'<< ");[/code] The little ' in between then >> << doesn't belong.
  3. Its because a header() function must be sent before ANY html gets output to the page.  That counts as even a blank space.  So if you ever close php and try to reopen php and send a header, wont work.  If you use echo or print before header ... it won't work.  If redirecting is that important to you, then do all of your user logging in before anything else hits the page, and try using a variable to set the Redirect through an if else statement.  If this variable is true, then run a redirect, otherwise no.
  4. I have a better answer .... Databases are your friend ... learn to use them.
  5. Your trying to get php to do too much for you with too little code.  The best solution for this, as I use this in my website, but in a different way is I get the image link stored in the database, then pull the link and put in the <img> tag.  Like so: [code]<img src="<? echo $IMAGE_VARIABLE_LINK; ?>">[/code] Don't try to add the image tags to php the way your doing, just manually add them and have php insert the link into the tag.  If people don't have a photo you can default to one if that input is empty.
  6. This DOES use phpBB, but thats not the concern.  I am trying to get this If / Else statement to read the $problem variable, but for some reason it just doesn't to, and it moves onto the item creation.  I have tried this current setup, isset(), and !isset().  Any help is appreciated. [code]///////////// // Weapons // ///////////// if ( $_POST['equipment_type'] == 'weapon' ) { if ( isset($_POST['submit']) ) { if ( !isset($_POST['weapon_name']) ) { $problem = '1'; $problem_statement = 'Your weapon did not have a name<br>'; } if ( !isset($_POST['weapon_type']) ) { $problem = '1'; $problem_statement = $problem_statement . 'Your weapon did not have a type<br>'; } if ( !isset($_POST['weapon_job1']) ) { $problem = '1'; $problem_statement = $problem_statement . 'Your weapon did not have a class<br>'; } if ( !isset($_POST['weapon_job1']) && isset($_POST['weapon_job2']) ) { $problem = '1'; $problem_statement = $problem_statement . 'There was a problem with the classes you chose.<br>'; } if ( !isset($_POST['weapon_job1']) && !isset($_POST['weapon_job2']) && isset($_POST['weapon_job3']) ) { $problem = '1'; $problem_statement = $problem_statement . 'There was a problem with the classes you chose.<br>'; } if ( !isset($_POST['weapon_dmg_low']) && !isset($_POST['weapon_dmg_hi']) ) { $problem = '1'; $problem_statement = $problem_statement . 'Your weapon is missing a damage parameter.<br>'; } if ( !isset($_POST['weapon_lvl']) ) { $problem = '1'; $problem_statement = $problem_statement . 'Your weapon is missing the level parameter.<br>'; } if ( !isset($_POST['weapon_cost']) ) { $problem = '1'; $problem_statement = $problem_statement . 'Your weapon is missing the cost parameter.<br>'; } if ( !isset($_POST['weapon_weight']) ) { $_POST['weapon_weight'] = '0'; } if ( !isset($_POST['weapon_def']) ) { $_POST['weapon_def'] = '0'; } if ($problem == '1') { if ( $_POST['weapon_hands'] == '1' ) { $template->set_filenames(array( 'body' => 'admin/weapon_add_one.tpl') ); $template->assign_vars(array( 'PROBLEM_STATEMENT' => $problem_statement )         ); } elseif ( $_POST['weapon_hands'] == '2' ) { $template->set_filenames(array( 'body' => 'admin/weapon_add_two.tpl') ); $template->assign_vars(array( 'PROBLEM_STATEMENT' => $problem_statement )         ); } } else { /**************************** * Insert weapon to database * *****************************/ $update = DATABASE INFO if (!$update) { message_die(GENERAL_MESSAGE, 'Your weapon could not be added.' ); } $success = TRUE; } } else { /************************ * Go to Add weapon Page * *************************/ if ( $_POST['weapon_hands'] == '1' ) { $template->set_filenames(array( 'body' => 'admin/weapon_add_one.tpl' ) ); } elseif ( $_POST['weapon_hands'] == '2' ) { $template->set_filenames(array( 'body' => 'admin/weapon_add_two.tpl' ) ); } $template->assign_vars(array( 'FORM_ACTION' => append_sid("admin_equipment.$phpEx") )         ); } [/code]
×
×
  • 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.