Cory94bailly Posted June 11, 2008 Share Posted June 11, 2008 <?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>(Eth32 Only!) 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 https://forums.phpfreaks.com/topic/109777-solved-blank-form-help/ Share on other sites More sharing options...
revraz Posted June 11, 2008 Share Posted June 11, 2008 Set them to something at the start of the script? Link to comment https://forums.phpfreaks.com/topic/109777-solved-blank-form-help/#findComment-563341 Share on other sites More sharing options...
Cory94bailly Posted June 11, 2008 Author Share Posted June 11, 2008 Set them to something at the start of the script? Huh..? Link to comment https://forums.phpfreaks.com/topic/109777-solved-blank-form-help/#findComment-563345 Share on other sites More sharing options...
xtopolis Posted June 12, 2008 Share Posted June 12, 2008 You may make your mysql database columns just have a default value. You can edit this in PHPMYADMIN easily. Link to comment https://forums.phpfreaks.com/topic/109777-solved-blank-form-help/#findComment-563738 Share on other sites More sharing options...
Cory94bailly Posted June 12, 2008 Author Share Posted June 12, 2008 You may make your mysql database columns just have a default value. You can edit this in PHPMYADMIN easily. 1.) I still get the Undefined index errors... 2.) It doesn't seem to work Link to comment https://forums.phpfreaks.com/topic/109777-solved-blank-form-help/#findComment-564219 Share on other sites More sharing options...
xtopolis Posted June 12, 2008 Share Posted June 12, 2008 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 https://forums.phpfreaks.com/topic/109777-solved-blank-form-help/#findComment-564243 Share on other sites More sharing options...
Cory94bailly Posted June 12, 2008 Author Share Posted June 12, 2008 The readonly thing worked.. But again, it still displays nothing if they don't check the boxes (Besides errors...) Link to comment https://forums.phpfreaks.com/topic/109777-solved-blank-form-help/#findComment-564360 Share on other sites More sharing options...
xtopolis Posted June 12, 2008 Share Posted June 12, 2008 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 https://forums.phpfreaks.com/topic/109777-solved-blank-form-help/#findComment-564391 Share on other sites More sharing options...
Cory94bailly Posted June 13, 2008 Author Share Posted June 13, 2008 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 https://forums.phpfreaks.com/topic/109777-solved-blank-form-help/#findComment-564414 Share on other sites More sharing options...
xtopolis Posted June 13, 2008 Share Posted June 13, 2008 <?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 https://forums.phpfreaks.com/topic/109777-solved-blank-form-help/#findComment-564433 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.