Jump to content

[SOLVED] Blank form help...


Cory94bailly

Recommended Posts

<?php
          date_default_timezone_set('America/New_York');
if (isset($_POST['submit']))
{
   $date     = date('m-d-Y');
   $time     = date("g:i a");
   $name     = mysql_real_escape_string($_POST['name']);
   $game     = mysql_real_escape_string($_POST['game']);
   $aimbot   = $_POST['aimbot'];
   $gui      = $_POST['gui'];
   $killspam = $_POST['killspam'];
   $ip       = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
   $hostname = mysql_real_escape_string(gethostbyaddr($_SERVER['REMOTE_ADDR']));

   //Insert the data.
   $query = mysql_query("INSERT INTO recentwanted (date, time, name, game, aimbot, gui, killspam, ip, hostname) VALUES ('$date', '$time', '$name', '$game', '$aimbot', '$gui', '$killspam', '$ip', '$hostname')") or die(mysql_error());

   echo "<meta http-equiv='refresh' content='1;url={$_SERVER['PHP_SELF']}'> Your request has been sent!";

}
else
{
?>
          <div id="text" >
                <h1>Service</h1>
          <p>Our team works fast and also looks for new skill and improvments.</p>
          <p>If you want to <b>order</b> any config to correct game aimbot...Please fill the following:</p>
           <ul>
           <form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
            <li><b>Name/Nick:</b> <input type="text" name="name" /></li>

            <li><b>Game:</b> <input type="text" name="game" value="Enemy Territory" disabled="disabled"/></li>

            <li><b>Aimbot:</b> <select name="aimbot">
<option value="eth32">ETH32</option>
<option value="flex">Crushr 666 Flex</option>
</select></li>

            <li><b>&#40;Eth32 Only!&#41; Gui:</b> <input type="checkbox" name="gui" value="Yes"></li>

            <li><b>Killspam:</b> <input type="checkbox" name="killspam" value="Yes"></li>

            <li><b>Style:</b></li>
            
            </ul>
            <tr><td colspan="2" align="right">
            <input type="submit" name="submit" value="Submit" />
            </td></tr>
            <br />
            <br />

Types of styles:
<ul>
<li>Supporting fast killing,means faster built That hits the hitbox.</li>
<li>Supporting heroic momvments which gives you the power to move and still make a headshot.</li>
</ul>
<br />
<b>
We are working 24/7 Hours.
The following Profiles contain information & there you could contact them about recovering service.

All the Best to the best.
Thanks!
</b>
<?
}
?>

 

 

There's my code..

 

It's not done but it almost is...

 

 

Now, I want it so the user selects the stuff and presses "Submit"...

 

Then it inserts all the info into a mysql DB...

 

Then, I have an admin panel to show it all but that is not my problem at the moment...

 

 

 

 

But when I submit it without two of the checkboxes submitted, it shows errors (below) and even if I have everything selected, it says theres no game thing.. blah.. Here's the error:

 

 

Notice: Undefined index: game in /home/content/m/a/r/markbailly/html/fcs/services.php on line 47

Notice: Undefined index: gui in /home/content/m/a/r/markbailly/html/fcs/services.php on line 49

Notice: Undefined index: killspam in /home/content/m/a/r/markbailly/html/fcs/services.php on line 50
Your request has been sent!

 

 

How do I put a default if they don't select it or something so that doesn't show? Like on the admin panel part, it shows game as blank always and gui & killspam blank if they don't select it...

 

 

Any help?

Link to comment
Share on other sites

You can try changing DISABLED to READONLY.  I don't think DISABLED values get $_POSTed.

 

Then change your checkbox name='s to this:

for Gui:  <input type="checkbox" name="gui[]" value="Yes">

for killspam: <input type="checlbox name="killspam[]" value="Yes">

 

The only thing I changed on them was adding [] to the end of their name.

Read this page to find out why: http://www.tizag.com/phpT/examples/formex.php/ and click continue on that page at the bottom to see the example code.

 

That should allow you to read those 3 values.  Let me know if this helps. Gl.

Link to comment
Share on other sites

The checkboxes won't be set at all if they are not checked.  You have to do a if(isset($_POST['gui'])) { //yes, they have a value }else{ //no, make them have a diff value; }

 

Consider this code: show as an example here: http://xtopolis.com/z_phpfreaks/checkbox/checkbox.php

<?php
if(isset($_POST['sub']))
{
  echo '<b>POST BEFORE DETERMINING CHECKBOXES</b><br />';
  print_r($_POST);
  
  if(!isset($_POST['food']))
  {
    $_POST['food'][0] = 'no';
  }
  
  echo '<br />Post after checking if checkbox was set<br />';
    print_r($_POST);
    
    echo '<br />Do I want chicken? <b>' . $_POST['food'][0] . '</b>';
}else{
?>
<form method="post">
  Chicken ? <input type="checkbox" name="food[]" value="Yes" />
  <input type="submit" name="sub" />
</form>

<?php
}
?>

<br /><a href='checkbox.php'>Reload</a>

 

Following this example and putting it in your code, you should get the results you want.  Let me know of your results.

Link to comment
Share on other sites

I'm having trouble...

 

Code:

          <?php
          date_default_timezone_set('America/New_York');
if(isset($_POST['submit']))
{  
  if(!isset($_POST['gui']))
  {
    $_POST['gui'][0] = 'No';
  }
}
{
   $date     = date('m-d-Y');
   $time     = date("g:i a");
   $name     = mysql_real_escape_string($_POST['name']);
   $game     = mysql_real_escape_string($_POST['game']);
   $aimbot   = $_POST['aimbot'];
   $gui      = $_POST['gui'];
   $killspam = $_POST['killspam'];
   $ip       = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
   $hostname = mysql_real_escape_string(gethostbyaddr($_SERVER['REMOTE_ADDR']));

   //Insert the data.
   $query = mysql_query("INSERT INTO recentwanted (date, time, name, game, aimbot, gui, killspam, ip, hostname) VALUES ('$date', '$time', '$name', '$game', '$aimbot', '$gui', '$killspam', '$ip', '$hostname')") or die(mysql_error());

   echo "<meta http-equiv='refresh' content='1;url={$_SERVER['PHP_SELF']}'> Your request has been sent!";

}
else
{
?>

 

 

Getting:

Parse error: syntax error, unexpected T_ELSE in /home/content/m/a/r/markbailly/html/fcs/services.php on line 66

Link to comment
Share on other sites

<?php
          date_default_timezone_set('America/New_York');
if(isset($_POST['submit']))
{  
  if(!isset($_POST['gui']))
  {
    $_POST['gui'][0] = 'No';
  }
}  //remove these braces } and { below, leave the other stuff alone ####
{  //these look out of place #######
   $date     = date('m-d-Y');
   $time     = date("g:i a");
?>

<?php
//   $gui      = $_POST['gui']; <-- old way
     $gui      = $_POST['gui'][0];//dont forget it's now an array index
//   $killspam = $_POST['killspam']; <-- old way
     $killspam = $_POST['killspam'][0]; //dont forget it's now an array index
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.