Jump to content

Search the Community

Showing results for tags 'dynamic'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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 (PhpStorm, VS Code, 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 15 results

  1. Hi guys, I really hope this will make sense. I am creating a dynamic field on a button click for Pickup Location. That works fine and submitting the form to the database works fine. However, instead of one entry, each time I submit the form with multiple Pickup Locations, it creates multiple separate database entries. Here is the PHP for submitting: if(isset($_POST['new']) && $_POST['new']==1){ $pickups = ''; foreach($_POST['pickups'] as $cnt => $pickups) $pickups .= ',' .$pickups; $locations = count($_POST["pickups"]); if ($locations > 0) { for ($i=0; $i < $locations; $i++) { if (trim($_POST['pickups'] != '')) { $name = mysqli_real_escape_string($con, $_POST['name']); $price = mysqli_real_escape_string($con, $_POST['price']); //$origin = $_POST['origin']; $pickups = $_POST["pickups"][$i]; $destination = mysqli_real_escape_string($con, $_POST['destination']); $dep_date = mysqli_real_escape_string($con, $_POST['dep_date']); $ret_date = mysqli_real_escape_string($con, $_POST['ret_date']); $fleet_number = mysqli_real_escape_string($con, $_POST['fleet_number']); $driver = mysqli_real_escape_string($con, $_POST['driver']); $itinerary = mysqli_real_escape_string($con, $_POST['itinerary']); $submittedby = mysqli_real_escape_string($con, $_SESSION["username"]); $trn_date = mysqli_real_escape_string($con, date("Y-m-d H:i:s")); $query="insert into tours (`name`, `price`, `pickups`, `destination`, `dep_date`, `ret_date`, `fleet_number`, `driver`, `itinerary`, `submittedby`, `trn_date`)values ('$name', '$price', '$pickups', '$destination', '$dep_date', '$ret_date', '$fleet_number', '$driver', '$itinerary', '$submittedby', '$trn_date')"; mysqli_query($con,$query) or die(mysqli_error($con)); if(mysqli_affected_rows($con)== 1 ){ $message = '<i class="fa fa-check"></i> - Record Inserted Successfully'; } } } } } Here is the HTML form: <form role="form" method="post" name="add_tour" id="add_tour" action""> <input type="hidden" name="new" value="1" /> <div class="modal-body"> <div class="row form-group"> <div class="col-6"> <div class="form-group"><label for="name" class=" form-control-label">Name</label><input type="text" id="name" name="name" placeholder="Tour Name" class="form-control"> </div> </div> <div class="col-6"> <div class="form-group"><label for="price" class=" form-control-label">Price</label><input type="text" id="price" name="price" placeholder="0.00" class="form-control"> </div> </div> </div> <div class="row form-group"> <div class="col-6"> <div class="form-group origin" id="pickupsfield"><label for="pickups" class=" form-control-label">Pickup Location</label><input type="text" id="pickups" name="pickups[]" placeholder="Start Typing..." class="form-control"></div> <button type="button" class="btn btn-success add-field" id="add" name="add">Add New Location &nbsp; <span style="font-size:16px; font-weight:bold;">+ </span> </button> </div> <div class="col-6"> <div class="form-group"><label for="destination" class=" form-control-label">Destination</label><input type="text" id="destination" name="destination" placeholder="Start Typing..." class="form-control"></div> </div> </div> <div class="row form-group"> <div class="col-6"> <div class="form-group"><label for="dep_date" class=" form-control-label">Departure Date</label><input type="date" id="dep_date" name="dep_date" placeholder="" class="form-control"></div> </div> <div class="col-6"> <div class="form-group"><label for="ret_date" class=" form-control-label">Return Date</label><input type="date" id="ret_date" name="ret_date" placeholder="" class="form-control"></div> </div> </div> <div class="row form-group"> <div class="col-6"> <div class="form-group"><label for="fleet_number" class=" form-control-label">Fleet Number</label> <select class="form-control" id="fleet_number" name="fleet_number"> <option value="Select">== Select Fleet Number ==</option> <?php $sql = "SELECT fleet_number FROM fleet"; $result = $con->query($sql); while(list($fleet_number) = mysqli_fetch_row($result)){ $option = '<option value="'.$fleet_number.'">'.$fleet_number.'</option>'; echo ($option); } ?> </select> </div> </div> <div class="col-6"> <?php ?> <div class="form-group"><label for="driver" class=" form-control-label">Driver</label> <select class="form-control" id="driver" name="driver"> <option value="Select">== Select Driver ==</option> <?php $sql = "SELECT name FROM drivers"; $result = $con->query($sql); while(list($driver) = mysqli_fetch_row($result)){ $option = '<option value="'.$driver.'">'.$driver.'</option>'; echo ($option); } ?> </select> </div> </div> </div> <div class="form-group"><label for="itinerary" class=" form-control-label">Itinerary</label> <textarea class="form-control" id="itinerary" name="itinerary"></textarea> </div> <div class="modal-footer"> <button type="reset" class="btn btn-warning">Clear Form</button> <button type="submit" name="submit" id="submit" class="btn btn-primary">Confirm</button> </div> </form> And the Javascript for adding the new fields: <script> $(document).ready(function(){ var i = 1; $("#add").click(function(){ i++; $('#pickupsfield').append('<div id="row'+i+'"><input type="text" name="pickups[]" placeholder="Enter pickup" class="form-control"/></div><div><button type="button" name="remove" id="'+i+'" class="btn btn-danger btn_remove">X</button></div>'); }); $(document).on('click', '.btn_remove', function(){ var button_id = $(this).attr("id"); $('#row'+button_id+'').remove(); }); $("#submit").on('click',function(){ var formdata = $("#add_tour").serialize(); $.ajax({ url :"", type :"POST", data :formdata, cache :false, success:function(result){ alert(result); $("#add_tour")[0].reset(); } }); }); }); </script> Anyone have any idea where I am going wrong? Before you say it, Yes, I know, Use Prepared statements 😷
  2. http://www.tirerack.com/content/tirerack/desktop/en/wheels.html See the window where it says "Shop by Vehicle"? Is there a script already out there that does the dropdown search by make/model/year? I am only looking for the front-end code; javascript/jquery code in particular.
  3. Hi all, I was hoping you could point me in the right direction, I have 2 questions. 1. I want to have an option drop down which uses the array of a returned sql query. I have the following code which uses onchange to submit the selection, how do I use the mysql_fetch_array($result1) to give a list of the two selected columns in the $Site=array() bit. 2. The selected result will be used in more SQL select statements, so once a site from the list is selected the relevant data from other tables will be displayed using e.g. select person from people [some inner join statement] where site="site 1"; Therefore the $_POST value must be available to be passed to other queries once selected. Thanks for any help, I still feel like a noob, but I'm getting there. Gary <?php include 'header.php'; ?> <div class='container'> <?php include 'menu.php'; ?> <?php include 'connect.php'; ?> <?php $sql1="SELECT Sites.Site_ID, Sites.Site_name_1 FROM `Sites`"; $result1=mysql_query($sql1); ?> <?php function get_options() { $site=array('Site 1'=>'Site 1', 'Site 2'=>'Site 2', 'Site 3'=>'Site 3'); $options=''; while(list($k,$v)=each($site)) { $options.='<option value="'.$v.'">'.$k.'</option>'; } return $options; } if(isset($_POST['site'])) { echo $_POST['site']; } ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> <select name="site" onchange="this.form.submit();"> <?php echo get_options(); ?> </select>
  4. I am not very advanced in web programming I need help.. I am using an API and my sql database. I would to implement live/ dynamic updates in the text field where user will input their text, and the web should first check the database then the api live. I would also like to retrieve the user input without refreshing the page, so the retrieved information regarding the inputted text should be automatically loaded without refreshing the page. please help .
  5. Hello: How could I use php to automatically insert the correct 3 letter month abbreviations and four digit year in the following pdf filenames on the first of each month? (For example "...Feb2015.pdf" then "...Mar2015.pdf" and so on.... <div>Book One: <a href="http://monthlybookfiles.mysite.com/BookOne_Jan2015.pdf">Download Here</a></div> <div>Book Two: <a href="http://monthlybookfiles.mysite.com/BookTwo_Jan2015.pdf">Download Here</a></div> <div>Book Three: <a href="http://monthlybookfiles.mysite.com/BookThree_Jan2015.pdf">Download Here</a> </div> <div>Book Four: <a href="http://monthlybookfiles.mysite.com/BookFour_Jan2015.pdf">Download Here</a> </div> Please advise, Eggie
  6. Hi there, I have a timetable plugin that shows booking entries. The times are generated dynamically by the plugin. Now I have the situation where I need to override the automatically created time that shows in a table row. Here's the HTML code generated by the plugin: <tr class="row_12"> <td class="tt_hours_column">00:00</td> Ist it possible to have a simple PHP script that does the following (please forgive my noobiness) ? if table row is "row_12" then insert "my own pre-defined time" Please don't hate on me, I know I have not the slightest idea about php. I'm just wondering how to solve my plugin problem and if PHP is the right way to do it. I highly appreciate any feedback from you guys
  7. Hello group, Apologies if this has been asked. I have a site that is generating pages like this: http://www.example.com/index.php?title_page=products_info&cPath=143&products_id=001 http://www.example.com/index.php?title_page=RFEE_SaaS_Cloud_Services http://www.example.com/index.php?title_page=customer_inquiry&src=mnu I want to create dynamic meta data in the header.php ex: <title><?php echo $pageTitle; ?></title> <meta name="description" content="<?php echo $pageDescription; ?>"> I'm new to the more advanced functions of php so my question is... where are the values for $pageTitle and $pageDescription stored if every page seems to reference index.php as the page (although there might be dynamic functionality within this page I suppose)? I could understand if the pages referenced were all different like products.php, services.php, etc. I'm looking at the URLs generated on the site and am trying to figure this out. Thanks.
  8. Normally you can get input names from form using $_GET method. However, with a multi level dropdown, the php query files are called externally and through the js code. So I am wondering, what is the best way to get the input names of each dropdown? For eg. country, state, city. Getting the input name for the country is easy; how would I get it for the state and city if they are in a seperate php files? Do I get the input name in their own files and put them in a session?
  9. This should be pretty easy but I can get this to work right. I am dynamically adding rows to a table and I want to append the number of the current row to the variable, these variables are arrays. (ex. variable1[], variable2[]) Example Code function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var currentRow = $(this).closest('tr'); var cell1 = row.insertCell(0); cell1.style.textAlign = 'left'; cell1.innerHTML = "<a onClick=\"deleteRow('dataTable', this.parentNode.parentNode.rowIndex)\" align=\"left\"> Remove this Guest</a>"; var cell2 = row.insertCell(1); var element2 = document.createElement("input"); element2.type = "checkbox"; element2.name="breakfast" + currentRow + "[]"; cell2.appendChild(element2); var cell3 = row.insertCell(2); var element2 = document.createElement("input"); element2.type = "checkbox"; element2.name="breakfast" + row + "[]"; cell3.appendChild(element2); So, I've tried using currentRow and row, still not working. Anyone have ideas?
  10. Hi I have a list of youtube videos in a flat file database. I would like to print a thumbnail of these videos out to the end user in a table. The results need to have pagination as well as a dynamic table so i can display say 3 rows and 3 columns per page. The column amount will also need to be adjustable in case i wish to change the columns from 3 to 4 for example: $video_file_data[]; //This is the array in which all video info will be stored $start = $_REQUEST['start']; //pagination setting $videos_per_page = 9; //Show 9 Vids per page $table_colums = 3; //Amount of columns needed to display results per page $num = count ($video_file_data); //Number of lines in data array $max_pages = @ceil($num / $videos_per_page); //Maximum number of Pages $cur = @ceil($start / $videos_per_page)+1; for($i=$start;$i<min($num,($start+$videos_per_page)+0);$i++) { list($date_added, $video_title, $youtube_url) = explode('|', trim($video_file_data[$i])); // <--- Table needs to go } The info stored in $video_file_data[] would look something like this: date 1."|".title 1."|".youtube url 1 date 2."|".title 2."|".youtube url 2 date 3."|".title 3."|".youtube url 3 date 4."|".title 4."|".youtube url 4 Many thanks for the help
  11. Hey guys ! I am working on a browse page that will allow an end user to browse any name category they want , simply by going to one dynamic php page labeled as browse.php This browse page will then check to see what is set after browse.php? and will then grab the appropriate data from the database and display this to the user. This is my first attempt at doing such a task, and figured i was doing just fine, until the actual part of displaying new data per request. my code is as follows: $names_0_9= $_GET['names_0_9']; $names_a = $_GET['names_a']; $names_b = $_GET['names_b']; $names_c = $_GET['names_c']; $names_d = $_GET['names_d']; $names_e = $_GET['names_e']; $names_f = $_GET['names_f']; $names_g = $_GET['names_g']; $names_h = $_GET['names_h']; $names_i = $_GET['names_i']; $names_j = $_GET['names_j']; $names_k = $_GET['names_k']; $names_l = $_GET['names_l']; $names_m = $_GET['names_m']; $names_n = $_GET['names_n']; $names_o = $_GET['names_o']; $names_p = $_GET['names_p']; $names_q = $_GET['names_q']; $names_r = $_GET['names_r']; $names_s = $_GET['names_s']; $names_t = $_GET['names_t']; $names_u = $_GET['names_u']; $names_v = $_GET['names_v']; $names_w = $_GET['names_w']; $names_x = $_GET['names_x']; $names_y = $_GET['names_y']; $names_z = $_GET['names_z']; if (isset($names_0_9) === true ) { echo 'names 0-9'; } else if (isset($names_a) === true ) { echo 'names a'; } else if (isset($names_ === true ) { echo 'names b'; } else if (isset($names_c) === true ) { echo 'names c'; } else if (isset($names_d) === true ) { echo 'names d'; } else if (isset($names_e) === true ) { echo 'names e '; } else if (isset($names_f) === true ) { echo 'names f'; } else if (isset($names_g) === true ) { echo 'names g'; } else if (isset($names_h) === true ) { echo 'names h'; } else if (isset($names_i) === true ) { echo 'names i'; } else if (isset($names_j) === true ) { echo 'names j'; }else if (isset($names_k) === true ) { echo 'names k'; } else if (isset($names_l) === true ) { echo 'names l'; } else if (isset($names_m) === true ) { echo 'names m'; } else if (isset($names_n) === true ) { echo 'names n'; } else if (isset($names_o) === true ) { echo 'names o'; } else if (isset($names_p) === true ) { echo 'names p'; } else if (isset($names_q) === true ) { echo 'names q'; } else if (isset($names_r) === true ) { echo 'names r'; } else if (isset($names_s) === true ) { echo 'shows s'; } else if (isset($names_t) === true ) { echo 'names t'; } else if (isset($names_u) === true ) { echo 'names u'; } else if (isset($names_v) === true ) { echo 'names v'; } else if (isset($names_w) === true ) { echo 'names w'; } else if (isset($names_x) === true ) { echo 'names x'; } else if (isset($names_y) === true ) { echo 'names y'; } else if (isset($names_z) === true ) { echo 'names z'; } else { header('Location: index.php'); exit(); All the links work correctly. Meaning, when i click on my link of a or link of b, i get sent to the browse.php?a or browse.php?b with the correct message. So i think to myself perfect, now i need to add the query for each letter and set the output for it to show to the user. What i then did was tried to create a very general query that i knew would return with data from mysql for the letter A. $query = "SELECT * FROM `content` WHERE `title` LIKE 'a%' LIMIT 0 , 30" Now this is where my novice php skills are being tested, and i lose course here to be able to correctly do what i want. I place this query inside the if statement ( or a similar query in the if else ) so that if this $_GET variable of 'a' is set that this query will be the main query to use. end of my code becomes else if (isset($names_a) === true ) { $query = "SELECT * FROM `content` WHERE `title` LIKE 'a%' LIMIT 0 , 30" } else if (isset($names_y) === true ) { echo 'names y'; } else if (isset($names_z) === true ) { echo 'names z'; } else { header('Location: index.php'); exit(); ?> <div class="left"> <div class="left_page_top"> <h1><a href="index.html">Home</a> > Featured Movies</h1> </div> <div class="left_body"> <div class="movie_table"> <ul> <?php while ($row = mysql_fetch_assoc($query)) { extract($row); echo '<li>'; echo '<div class="profile_pic"><a href="profile.php?user=' .$profie_title . '&userid=' .$id .'"><img src="http://i.imgur.com/Epdwv1t.jpg" width="101" height="150"></a></div>'; echo '<div class="user_about">'; echo '<div class="user_about_text">'; echo '<h1><a href="profile.php?user=' .$profile_title . '&userid=' .$id .'">' . $profile_title . ' (2013)</a></h1>'; echo '<div class="c">Class: ' .$class . '</div>'; echo 'Join Date:' . $join_date . '<br>'; echo 'Views: <span>194526</span> (<span>176</span> votes)<br>'; echo 'Votes:' .$votes .' <br>'; echo '</div>'; echo '<div class="user_about_">'; echo '<div class="vote">'; echo '<div id="Mark">'; echo '<div id="Maro">Rating: <span id="Rate_36387"> ' . $user_rating . ' </span></div>'; echo '</div>'; echo '</div>'; echo '</div>'; echo '</div>'; echo '</li>'; } ?> </ul> </div> </div> </div> </div> So what i thought i wanted to do since i am essentially outputting the members in a 2x 25 list that is scroll able depending on how much data is returned from the database. now for some reason when i click on the letter a. nothing is outputted. i really cant figure out where i went wrong or if i am even on the right track at this point. any suggestions or any ideas ? any help is much appreciated, i have been stuck on this for a couple days now.
  12. Hi there! I've been having some trouble for quite some time now with a form. I have a table that I'm grabbing data from. I want to update multiple rows with a form. However, I have multiple text boxes under each row I want to update with only one submit button. When I press the submit button nothing happens. I'm not sure why. I've been having trouble with this forever, like I said. I would really, really like to get this done as it's holding me back from doing other things on my site. I will post the part of the code where I'm having the trouble. I don't think I will need to post the whole code since there are other parts of it that don't involve this at all. Here is the code: if($action == "stock") { $setprice = $_POST['price']; $updateprice = $_POST['updateprice']; echo "<a href=?action=edit>Edit Shop</a> | <a href=?action=view&user=$showusername>View Shop</a> | <a href=?action=stock>View Stock</a> | <a href=?action=quick>Quick Stock</a><br><br><font size=5>Stock Shop</font><br><br>"; $eq = "SELECT * FROM uitems WHERE username='$showusername' AND location='2' GROUP BY theitemid"; $ee = mysql_query($eq); while($erow = mysql_fetch_array($ee)) { $eeloc = $erow['location']; $eeid = $erow['theitemid']; $eenowid = $erow['uitemid']; $eeprice = $erow['price']; $wq = "SELECT * FROM items WHERE itemid='$eeid'"; $ww = mysql_query($wq); while($wrow = mysql_fetch_array($ww)) { $cq = mysql_query("SELECT * FROM uitems WHERE username='$showusername' AND location='2' AND theitemid='$eeid'"); $lcq = mysql_num_rows($cq); $fid = $wrow['itemid']; $fname = $wrow['name']; $fimage = $wrow['image']; $frarity = $wrow['rarity']; $fdesc = $wrow['description']; echo "<br>$fname<br><img src=/images/items/$fimage><br><br>"; ?> <input type="text" name="price" value="<?php echo "$eeprice"; ?>"><br></form> <?php } ?> <?php } ?> <br><br><input type="submit" name="updateprice" value="Update Prices"><br><br> <form action="<?php echo "$PHP_SELF"; ?>" method="POST"></form> <?php if(isset($setprice)) { mysql_query("UPDATE uitems SET price='$setprice' WHERE username='$showusername' AND theitemid='$fid'"); echo "<font color=green>Success! Your prices have been set and updated!</font><br><br>"; } } Before anybody says anything about it, I know my variable names are ridiculous.. so you don't even need to say that, lol. I have trouble naming my variable because I use so many in my codes. I'll have to come up with a better way to name them. Basically what this code is doing is grabbing the data with the specific location, displaying it and displaying the form. However, the form is not updating. Any help would be appreciative! Also, there was a time when the form DID work, but it did not update.... it just reloaded the page and left the text fields blank. Thanks again guys!
  13. Hello all! First, im very new to this forum.. and i'm really liking it! Second, i'm having this problem. I created this php dropdown menu allowing a user to select a specific phone make, model, color, size, and condition. However, when i run the script i only get the two makes i initialize within the code "Apple" and "Samsung." Can someone take a look at my code and see if its the issue? My back end looks like so: Database name: model MODEL_ID int(11) Key - Auto increment MAKE_ID int(11) MODEL_NAME varchar(30) Database name: color COLOR_ID int(11) Key - Auto increment MODEL_ID int(2) COLOR_NAME varchar(20) Database name: size SIZE_ID int(11) Key -Auto increment COLOR_ID int(2) SIZE_NAME varchar(40) Database name: con CON_ID int(11) Key -Auto increment SIZE_ID int(2) CON_NAME varchar(20) <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_custsqlmoo16 = ""; $database_custsqlmoo16 = ""; $username_custsqlmoo16 = ""; $password_custsqlmoo16 = ""; $custsqlmoo16 = mysql_pconnect($hostname_custsqlmoo16, $username_custsqlmoo16, $password_custsqlmoo16) or trigger_error(mysql_error(),E_USER_ERROR); ?> <?php $make = $model = $color = $size = $con = null; //declare vars $conn = mysql_connect('localhost'); $db = mysql_select_db('testing',$conn); if(isset($_GET["make"]) && is_numeric($_GET["make"])) { $make = $_GET["make"]; } if(isset($_GET["model"]) && is_numeric($_GET["model"])) { $model = $_GET["model"]; } if(isset($_GET["color"]) && is_numeric($_GET["color"])) { $color = $_GET["color"]; } if(isset($_GET["size"]) && is_numeric($_GET["size"])) { $size = $_GET["size"]; } if(isset($_GET["con"]) && is_numeric($_GET["con"])) { $con = $_GET["con"]; } ?> <script language="Javascript"> function autoSubmit() { var formObject = document.forms['theForm']; formObject.submit(); } </script> <form name="theForm" method="get"> <select name="make" onchange="autoSubmit();"> <option value="null"></option> <option value="1" <?php if($make == 1) echo " selected"; ?>>Apple</option> <option value="2" <?php if($make == 2) echo " selected"; ?>>Samsung</option> </select> <br><br> <?php if($make != null && is_numeric($make)) { ?> <select name="model" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH model FROM A GIVEN make $sql = "SELECT MODEL_ID, MODEL_NAME FROM model WHERE MAKE_ID = $make"; $model = mysql_query($sql,$conn); while($row = mysql_fetch_array($model)) { echo ("<option value=\"$row[MODEL_ID]\" " . ($model == $row["MODEL_ID"] ? " selected" : "") . ">$row[MODEL_NAME]</option>"); } ?> </select> <?php } ?> <br><br> <?php if($model != null && is_numeric($model) && $make != null) { ?> <select name="color" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH COLORS FROM A GIVEN MAKE, MODEL $sql = "SELECT COLOR_ID, COLOR_NAME FROM color WHERE MODEL_ID = $model "; $color = mysql_query($sql,$conn); while($row = mysql_fetch_array($color)) { echo ("<option value=\"$row[color_ID]\" " . ($color == $row["COLOR_ID"] ? " selected" : "") . ">$row[color_NAME]</option>"); } ?> </select> <?php } ?> <br><br> <?php if($color != null && is_numeric($color) && $make != null && $model != null) { ?> <select name="size" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH SIZES FROM A GIVEN MAKE, MODEL, COLOR $sql = "SELECT SIZE_ID, SIZE_NAME FROM SIZE WHERE COLOR_ID = $color "; $size = mysql_query($sql,$conn); while($row = mysql_fetch_array($size)) { echo ("<option value=\"$row[size_ID]\" " . ($size == $row["SIZE_ID"] ? " selected" : "") . ">$row[size_NAME]</option>"); } ?> </select> <?php } ?> <br><br> <?php if($size != null && is_numeric($size) && $make != null && $model != null && $color != null) { ?> <select name="con" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH CONDITIONS FROM A GIVEN MAKE, MODEL, COLOR, SIZE $sql = "SELECT CON_ID, CON_NAME FROM CON WHERE SIZE_ID = $size "; $con = mysql_query($sql,$conn); while($row = mysql_fetch_array($con)) { echo ("<option value=\"$row[CON_ID]\" " . ($con == $row["CON_ID"] ? " selected" : "") . ">$row[CON_NAME]</option>"); } ?> </select> <?php } ?> </form> Thanks ahead of time!
  14. Bonjour, Been hunting the internet to find a solution myself, but instead thought I'd just ask on here. After all, if you don't ask, you don't get. Basically, I am creating a internal web based e-mail generator for the company I work for, that will send an e-mail to 'handover' certain 'tasks' to the next team on the next shift - It will be used internal only, so please excuse some of the sloppy coding but we only need it to 'work' - Doesn't really matter how! Anyway, the when someone goes through the form, they are given the options to add 'tasks' to the e-mail, these 'tasks' gets stored into a MySQL database, with the 'DONE' value of '0', ready for when the next person goes to generate the 'handover' - When the next person goes to generate the 'handover', they get a list of the 'tasks', that were previously inserted, by the previous person. Like so: They are given the option to mark the task as done, or not. Now here's the part where I get stuck... The subsequent 'handover' queries the MySQL database to see which 'tasks', have a 'DONE' value of '0' (not done). It then lists them. Here is the code: $toq2= mysql_query("SELECT * FROM tasks WHERE done='0'"); $toq2p = mysql_fetch_array( $toq2 ); $toq2r = mysql_num_rows( $toq2 ); if ($toq2r >= 1) { echo "<table border='0'><tr><td></td><td></td><td></td><td><img src='/assets/tick.png' width='20px' height='20px' border='0' /></td>"; $toq4= mysql_query("SELECT * FROM tasks WHERE done='0'"); while($toq4p = mysql_fetch_array( $toq4 )) { echo "<font color='black' size='2'><tr><td><font size='2'><strong>{$toq4p['system']}</strong></font> - </td><td><font size='2'><em>{$toq4p['region']}</em></font> - </td><td><font size='2'>{$toq4p['description']}</font></td><td><input type='checkbox' name='todo1[]' value='1'></td></font></tr>"; } echo "</table><br />"; } else { echo "<h3><font color='red'>NOTHING TO HANDOVER</font></h3>"; } Problem I have, is that because the amount of tasks is never consistent, I can't have a set query for the amount of values, therefore I need to find a way to dynamically set each row to update the 'done' value in the MySQL table to '1' if the box is ticked and leave it as '0', if the box isn't ticked. I hope I've explained myself well enough and appreciate any help that anyone can provide. Many thanks, P.S: Tasks are created as needed and are NOT in a schedule.. as so: When inserted from here, the value of 'done' is set to '0' - From the task list (picture in original post), if the person ticks the checkbox, I want it to be able to update that value of 'done' to '1'.
  15. Hello I am looking for some help in trying to generate a dynamic table, where each row is an input field, based on the input from another field.. So, I have an input field called number, which will allow me to enter a number I then want to generate a table with that number of input fields Can someone help? Thanks
×
×
  • 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.