Jump to content

Search the Community

Showing results for tags 'checkbox'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 10 results

  1. I am trying to implement the new version of captcha on my website. What i did so far: Inside the FORM: echo '<div class="g-recaptcha" data-sitekey="XXXXXXXXXXXXXXXXXXXXXXXXXXXX"></div>'; Inside PHP: $recaptcha = $_POST['g-recaptcha-response']; if(!empty($recaptcha)) { $google_url = "https://www.google.com/recaptcha/api/siteverify"; $secret = 'YYYYYYYYYYYYYYYYYYYYYYYYYYY'; $ip = $_SERVER['REMOTE_ADDR']; $url = $google_url."?secret=".$secret."&response=".$recaptcha."&remoteip=".$ip; $res = getCurlData($url); $res = json_decode($res, true); if($res['success'] == 'false') { $captcha_error = "Please re-enter your reCAPTCHA."; } } The getCurlData function: function getCurlData($url) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_TIMEOUT, 10); curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20110319 Firefox/3.6.16"); $curlData = curl_exec($curl); curl_close($curl); return $curlData; } What i want to achieve is to know when the no-Captcha box is checked. I want to throw an error to the user if he/she did not check that box. So far i only throw an error if the response from Google is "We are not sure if you are human, please proceed to our second level of verification" [if($res['success'] == 'false')]. PS: most of the code is written by Srinivas Tamada. You can find it here. Thanks in advance.
  2. ingerNorway

    Checkbox-1/0-into database

    Hi I wondering what i did wrong here: I wont to register 1 or 0 into database. Checkbox file: <?php include("db-tilkobling.php"); $sqlSetning="SELECT * FROM Kvarterbestilt ORDER BY Møtt;"; $sqlResultat=mysqli_query($db,$sqlSetning) or die ("Ikke mulig å hente data fra databasen"); $antallRader=mysqli_num_rows($sqlResultat); print("<input type='checkbox' name='møtt' value='$møtt'>"); ?> Register-møtt.php <?php include("start.html"); ?> <br/> <p>Registrer Møtt/Ikke møtt ved å fylle ut skjemaet under</p> <form method="post" action="" id="registrerAnsattSkjema" name="registrerAnsattSkjema"> <fieldset> <legend>Registrer møtt / ikke møttt</legend> <label for="personnummer">Personnummer</label> <?php include("listeboks-personnummer.php"); ?><br/> <label for="timenummer">Timenummer</label> <?php include("listeboks-timenummer.php"); ?><br/> Sjekk av denne boksen hvis pasient har møtt til time:<br/> <?php include("checkbox-møtt.php"); ?><br/> <input type="submit" name="registrerMottKnapp" id="registrerMottKnapp" value="Registrer møtt/ikke"> <input type="reset" name="nullstill" id="nullstill" value="nullstill"> </fieldset> </form><br/> <?php /* include("valider-mott.php");*/ $registrerMottKnapp=$_POST ["registrerMottKnapp"]; if ($registrerMottKnapp) { $personnummer=$_POST["Personnummer"]; $timenummer=$_POST["Timenummer"]; $møtt=$_POST["Møtt"]; } if ($møtt == '1') { $query = mysql_query("INSERT INTO Kvarterbestilt(Møtt) VALUES('1')"); } /* $lovligFornavn=validerFornavn ($fornavn); $lovligFornavn2=validerFornavn2 ($fornavn); $lovligFornavn3=validerFornavn3 ($fornavn); $lovligEtternavn=validerEtternavn ($etternavn); $lovligEtternavn2=validerEtternavn2 ($etternavn); $lovligEtternavn3=validerEtternavn3 ($etternavn); $lovligYrke=validerYrke ($yrke); $lovligYrke2=validerYrke2 ($yrke); $lovligYrke3=validerYrke3 ($yrke); if (!$lovligFornavn) { print("Fornavn er ikke fylt ut! <br/>"); } else if (!$lovligFornavn2) { print("Bare bokstaver og mellomrom er tillat; $fornavn<br/>"); } else if (!$lovligFornavn3) { print("Ingen tall tillat; $fornavn<br/>"); } else if (!$lovligEtternavn) { print("Etternavn er ikke fylt ut!<br/>"); } else if (!$lovligEtternavn2) { print("Bare bokstaver og mellomrom er tillat; $etternavn<br/>"); } else if (!$lovligEtternavn3) { print("Ingen tall tillat; $etternavn<br/>"); } else if (!$lovligYrke) { print("Yrke er ikke fylt ut!<br/>"); } else if (!$lovligYrke2) { print("Bare bokstaver og mellomrom er tillat; $yrke<br/>"); } else if (!$lovligYrke3) { print("Ingen tall tillat; $yrke<br/>"); } */ /* include("db-tilkobling.php"); $check=mysqli_query($db,"SELECT * FROM Kvarterbestilt WHERE Personnummer='$personnummer' AND Timenummer='$timenummer'"); $checkrows=mysqli_num_rows($check); if($checkrows>0){echo "Ansatt eksiterer fra før";} else { $sqlSetning="INSERT INTO Kvarterbestilt(Møtt) WHERE Personnummer='$personnummer' VALUES ('$møtt');"; mysqli_query ($db,$sqlSetning) or die ("Ikke mulig Ã¥ registrere i db"); print ("Det er registrert at pasienten har $møtt til timen $timenummer"); } } */ include("slutt.html"); ?>
  3. so i have my database form which you can select a some data using the checkbox and when submitting it should get the row info and display it on the next page iv been struggling for days on this and cant work out how to do it please could i have some help <form name="test" method="post" action="shoppingbasket.php" > <input type="submit" value="Submit" > <?php $conn = pg_connect("host=db.dcs.aber.ac.uk port=5432 dbname=teaching user=csguest password=r3p41r3d"); $res = pg_query ($conn, "SELECT artist,composer,genre,title,album,label,price,description FROM music"); echo "<table border='1'>"; echo "<tr><th>Select</th><th>Artist</th><th>Composer</th><th>Genre</th><th>Title</th><th>Album</th><th>Label</th><th>Price</th><th>Description</th></tr>"; while ($row = pg_fetch_row($res)) { echo "<tr>"; echo '<td><input type="checkbox" name="check_list[]" value="' . $row['ref'] . $row['artist'] . '"></td>'; for ($column = 0; $column < pg_num_fields($res); $column++) { echo "<td>" . $row[$column] . "</td>"; } echo "</tr>"; } echo "</table>\n"; ___________________________________________________________________________________________________ shopping basket.php <?php echo "<table border='1'>"; echo "<tr><th>Select</th><th>Artist</th><th>Composer</th><th>Genre</th><th>Title</th><th>Album</th><th>Label</th><th>Price</th><th>Description</th></tr>"; if(!empty($_POST['check_list'])){ foreach($_POST['check_list'] as $row){ echo "$row was checked! "; } } ?> </form> </body> </html>
  4. jamesreno20

    php array error checkbox

    database.php ________________________________________________________________________________________ $res = pg_query ($conn, "SELECT artist, composer, genre, title, album, label, price, description FROM music"); echo "<table border='1'>"; while($a = pg_fetch_array($res)){ echo "<td>" . $a['1'] . "</td>"; echo "<td>" . $a['2'] . "</td>"; echo "<td>" . $a['3'] . "</td>"; echo "<td>" . $a['4'] . "</td>"; echo "<td>" . $a['5'] . "</td>"; echo "<td>" . $a['6'] . "</td>"; echo "<td>" . $a['7'] . "</td>"; echo '<td><input type="checkbox" name="music[]" value="$ref"' . $row['0'] . $row['1'] . $row['2'] . $row['3'] . $row['4'] . $row['5'] . $row['6'] . $row['7'] . '"/></td>'; echo"</tr>"; } echo "</table>\n"; ?> _____________________________________________________________________________- shoppingbasket.php _____________________________________________________________________________- <form action="shoppingbasket.php" method="POST"> Send To Basket: <name="music"> <input type="submit" value="submit"> </form> cant get it to send data from database to this page shoppingbasket.php if(isset($_POST['music'])){ if (is_array($_POST['music'])) { foreach($_POST['music'] as $row){ echo $row; } } else { $row = $_POST['music']; echo $row; } }
  5. matthewlevering

    CRUD Update page with Checkboxes

    Greetings All, This place is always so gracious in assisting help to struggling noob developers, I thought i would give this a try. I ran into a wall with my first intranet application. We have a forms library. Which is a basic CRUD set up. A user logs into creates a form. Other users go to edit it. I can't seem to figure out how to have checkboxes/radio buttons populate with the data from my database and be editable. I have each of these checkboxes going in as an array[]. I cant seem to be able to figure out how to see if the option is selected and then show as checked. And if not checked have it appear not checked. I want the update form to appear exactly as the create form but populated with data it was populated with previously. I think half my problem is being able to articulate the issue because google isn't yielding any good results. I would be extremely thankful and grateful to anyone who could point me in the right direction or send me to a good resource. Thank you for your Time.
  6. i have checkbox in a table and want to put the value as the id in the database then when i press submit it displays all the row data for each checkbox $res = pg_query ($conn, "SELECT artist,composer,genre,title,album,label,price,description FROM music"); echo "<table border='1'>"; echo "<tr><th>Select</th><th>Artist</th><th>Composer</th><th>Genre</th><th>Title</th><th>Album</th><th>Label</th><th>Price</th><th>Description</th></tr>"; while ($row = pg_fetch_row($res)) { echo "<tr>"; echo '<td><input type="checkbox" name="check_list[]" value="' . $row['res'] .'"></td>'; for ($column = 0; $column < pg_num_fields($res); $column++) { echo "<td>" . $row[$column] . "</td>"; } echo "</tr>"; } echo "</table>\n"; ________________________________________________-- basket.php echo "<table border='1'>"; echo "<tr><th>Select</th><th>Artist</th><th>Composer</th><th>Genre</th><th>Title</th><th>Album</th><th>Label</th><th>Price</th><th>Description</th></tr>"; echo "<pre>\n"; print_r($_POST['check_list']); echo "</pre>\n";
  7. hey guys so im trying to display data into text boxes that are fetched from database according to checkbox with value id. processing is located before <!DOCTYPE html>: if(isset($_POST['edit_event']) && isset($_POST['check'])) { require "connection.php"; foreach ($_POST['check'] as $edit_id) { $edit_id = intval($GET['event_id']); //i tried (int)$edit_id; $sqls = "SELECT event_name,start_date,start_time,end_date,end_time,event_venue FROM event WHERE event_id IN $edit_id "; $sqlsr = mysqli_query($con, $sqls); $z = mysqli_fetch_array($sqlsr); { } button and form opens: <form method="post" action="event.php"> <input type="submit" name="edit_event" value="Edit Event"> this is the html where the data will be echoed: <div id="doverlay" class="doverlay"></div> <div id="ddialog" class="ddialog"> <table class="cevent"> <thead><tr><th>Update Event</th></tr></thead> <tbody> <tr> <td> <input type="text" name="en_" value="<?php echo $z['event_name']; ?>"> </td> </tr> <tr> <td> <input type="text" name="dates_" value="<?php echo $z['start_date']; ?>"> <input type="text" name="times_" value="<?php echo $z['start_time']; ?>"> </td> </tr> <tr> <td><input type="text" name="datee_" value="<?php echo $z['end_date']; ?>"> <input type="text" name="time_" value="<?php echo $z['end_time']; ?>"> </td> </tr> <tr> <td><input type="text" name="ev_" value="<?php echo $z['event_venue']; ?>"> </td> </tr> <tr> <td><input type="submit" name="update" value="Update Event" id="update"> <input type="submit" id="cancelupdate" name="cancel" value="Cancel" > </td> </tr> </tbody> </table> </div> this is the part which is populated by data from database where isset($_POST['check']) gets the 'check' from: echo "<tr> <td><input type='checkbox' name='check[]' value='$id'>$name </td> </tr>"; </form> thanks in advance!
  8. Hi there guys, I've made some new checkbox fields in my wordpress template using Meta box. Now i want to display those selected checkboxes in the forntend, but it will display only the first checkbox that i've checked, not the other ones. The problem seems to by the array functions that displays only the first checkbox. I'll put bellow the codes that i've been using: This is the code from the meta-box-config.php // General ////////////////////////////////////////////////////////////////////////////////////// array( 'name' => 'Genearal', 'id' => "{$prefix}utilitati_general", 'clone' => false, 'type' => 'checkbox_list', 'options' => array( 'Curent Electric' => __('Curent electric','locality'), 'Telefon' => __('Telefon','locality'), 'Apa' => __('Apa','locality'), 'Gaz' => __('Gaz','locality'), 'Cablu TV' => __('Cablu TV','locality'), 'Canalizare' => __('Canalizare','locality') ), 'std' => false ), This is the code from the frontpage // General ////////////////////////////////////////////////////////////////////////////////////// $locality_utilitati_general = get_post_meta($post->ID, 'locality_utilitati_general', true); if(!empty($locality_utilitati_general)) { ?> <?php _e('General: ','locality'); ?><?php echo implode(',', $_POST['locality_utilitati_general']); ?> <?php }
  9. davidolson

    php checkbox help

    function get_checked($variable, $status){ if($variable == $status){ return 'checked="checked"'; }else{ return ''; } } <input type=\"checkbox\" name=\"emailNewsletter\" value=\"Yes\" ".get_checked($emailNewsletter, 'Yes')."> <input type=\"checkbox\" name=\"emailInbox\" value=\"Yes\" ".get_checked($emailInbox, 'Yes')."> $emailNewsletter = isset($_POST['emailNewsletter']) ? filter_input(INPUT_POST, 'emailNewsletter') : 'No'; $emailInbox = isset($_POST['emailInbox']) ? filter_input(INPUT_POST, 'emailInbox') : 'No'; If no submit button clicked display mysql information $userInfo['emailInbox'] instead of 'NO' . How to do that?
  10. Hi guys, I have a huge problem with inserting multiple checked checkboxes into database and thene display checkones on frontend. In other word i have 2 problems regarding these checkboxes. 1. I have 3 checkboxes into user profile panel lets say checkbox 1, checkbox 2, etc. The user select the first 2 ones and inserts them into database. When he returns to his profile to edit his details, i want to display to the user those 2 checkbox that he selected earlier. 2. The secound problem i have is that i have a weekly calendar with week days and some hour intervals. For this the user must select the hours for a day when he is available and on his frontend profile to display them. This is another thing that i can't manage to do, and want a ideea. A print scrit of this calendar is attached to this message.

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.