A JM
Members-
Posts
249 -
Joined
-
Last visited
Everything posted by A JM
-
Thanks for the suggestion but the value and text must remain different. Is it possible to have the ID set to something different and can PHP read the ID on Submit? Thanks.
-
duh! thanks for the reply... I realize that now. A JM,
-
I want to read the selected "text" from a <SELECT> on my form and not the "value" how would I do that? All I can find is how to read the "value" and since my "value" and "text" are different the "text" is what I need. Thanks. A JM,
-
Makes some sense to just trap the error, thanks. So even though the query produces no results would that still generate the page, just without data? I guess I'm setting this up incorrectly as I'm showing the user the result page of a query that hasn't been run - so it probalby makes more sense to create a page with just the criteria and then create the result page. A JM,
-
I'm working on building a query page for my site which will allow users to select from drop downs what items to query the database on. I've created my result page with pagination, fields and filed names. The question that I have is when the user loads the page it runs a default query that then populates the page page - how can I set up my page to have an empty result that won't error with mySQL? Do I have to create my query options page as a separate page and then show the result page on the submit? Thanks for any ideas and suggestions. A JM,
-
OK, thanks for the information. A JM,
-
So if I'm in the states I shouldn't have to worry about accented characters correct? Thanks.
-
Can someone tell me what this function is doing? This is in regard to file renaming routine. $file = ereg_replace("[^a-zA-Z0-9_.-\[\]()]", "", strtr($file, "()áàâãäéèêëíìîïóòôõöúùûüçÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ ", "[]aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC_")); $tempFile = $_FILES['Filedata']['tmp_name']; $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_GET['folder'] . '/'; $file = $_FILES['Filedata']['name']; $file = utf8_decode($file); $file = ereg_replace("[^a-zA-Z0-9_.-\[\]()]", "", strtr($file, "()áàâãäéèêëíìîïóòôõöúùûüçÁÀÂÃÄÉÈÊËÍÌÎÏÓÒÔÕÖÚÙÛÜÇ ", "[]aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC_")); $file = strtolower($file); $aux_targetFile = str_replace('//','/',$targetPath); $targetFile = str_replace('//','/',$targetPath) . $file; $returnFile = $_FILES['Filedata']['name']; if(file_exists($targetFile)) { while ($ok != true) { if(file_exists($targetFile)) { $ok = false; $rand = rand(1000, 9999); $targetFile = $aux_targetFile . $rand . $file; } else { $ok = true; $file = $rand . $file; } } } move_uploaded_file($tempFile,$targetFile);
-
I, or anyone else for that matter, can submit to your forms without using their web browser. PHP has extensions that allow you to send POSTs to URLs as if you were a web browser. In that case it wouldn't matter that you told me the field was readonly; I'd just post to it anyways. Alternatively a user can open the page in their browser and then save it to their hard drive. You then edit the HTML on your local hard drive to change the form action to the appropriate URL and remove the readonly="readonly" from the input-tag. You can then open the file back up in a web browser, fill out the form, and submit it back to the originating web site. Therefore adding readonly="readonly" to the input is a good way of letting the user know they can't change it. But if you don't recheck their ability to edit the field on the page that receives the form POST, they'll just get around your readonly control in one of the manners I mentioned above. Assuming your a logged in user on my site then I think that would make sense. By the way this also works. <?php if($readonlytextboxes) { echo "readonly=readonly"; }?>
-
This is what the source looks like: <input type="text" name="clnt_name" id="clnt_name" tabindex="3" class="form-inputitem" value="namea" READONLY size="50" /> I had been seeing people reference the uppercase "O" for browser reasons not sure of the reasoning behind it though. I'll try <?php if(!$userIsAbleToEditThisBox) { echo 'readonly="readonly"'; }?> and see how it goes. A JM,
-
Lonewolf, actually this did work... I was using the wrong variable... user error - many thanks! <input type="text" name="clnt_name" id="clnt_name" tabindex="3" class="form-inputitem" value="<?php echo htmlentities($row_rstocdetail['clnt_name'], ENT_COMPAT, 'utf-8'); ?>" <?php if($readonlytextboxes) { echo "READONLY"; }?> size="50" /> Last question on this subject - roopurt18 was warning about verifying that the user can update when submitting. Could someone give me some insight into what he is referring and how would I avoid this from happening? Thanks. A JM,
-
Unfourtunately since I'm not familiar with how to accomplish this I have to resort to guessing and reading and asking... this by the way no workey.. Nor does this: <input type="text" name="clnt_name" id="clnt_name" tabindex="3" class="form-inputitem" value="<?php echo htmlentities($row_rstocdetail['clnt_name'], ENT_COMPAT, 'utf-8'); ?>" <?php if(!$userIsAbleToEditThisBox) { echo "READONLY"; }?> size="50" /> However lonewolf - the textbox has been set to readonly in the above instance, but never to allow editing. I verified that indeed when the record is selected the variable is either a 0 or 1. //if user is not allowed set variable for turning off the textbox capability it will be a 1 else a 0 $readonlytextboxes = $row_rstocdetail['chk_allowediting']; print_r($readonlytextboxes); exit;
-
Lonewolf, that makes some sense how do I actually implement that on my form? This is an example: <input type="text" name="clnt_name" id="clnt_name" tabindex="3" class="form-inputitem" value="<?php echo htmlentities($row_rstocdetail['clnt_name'], ENT_COMPAT, 'utf-8'); ?>" size="50" /> would it look like this? <input type="text" name="clnt_name" id="clnt_name" tabindex="3" class="form-inputitem" value="<?php echo htmlentities($row_rstocdetail['clnt_name'], ENT_COMPAT, 'utf-8'); ?>" readonly=<?php if(!$readonlytextboxes) { echo "true"; }> size="50" />
-
I don't know how to make this happen so I was just giving it a go.. The form has a multi-use, for some users $readonlytextboxes == 0 I want them to be able to input information into the textboxes for other users $readonlytextboxes == 1 I just want them to be able to view the contents of the textboxes and not be able to edit/make changes. Is there a better way to do this? Thanks. A JM,
-
Thanks for the post but that only sets 1 box - I need them all to be readonly.. A JM,
-
I'm trying to set my forms textboxes to readonly only if a varible is set, can someone help me with what I'm dong wrong? <?php if ($readonlytextboxes == 1) { echo "<script type='text/javascript'>"; echo "alert('readonly')"; echo "for(i=0; i<document.form1.elements.length; i++)"; echo "{"; echo "if(document.form1.elements[i].type=='text')"; echo "{"; echo "document.form1.elements[i].readOnly=true"; echo "}"; echo "}"; echo "</script>"; } ?>
-
I'm sorry I don't understand what you mean?
-
Ultimately I'm planning on using the selected items from both select boxes in a query for the current page so I'm open to suggestions. Ignace, does that mean that after the user selects the first item that the page needs to post? I'm still a bit fuzzy about how to correctly use $_POST to refresh the current page. Not sure I'm reading the script correctly: If $_POST not empty then test for 'first_select' not empty and 'second_select' is empty run query to populate second select if true else if 'first_select' not empty and 'second_select' not empty set variables. Could I then run my query for the page after both are filed? How do I refresh the page? ... $first_select = $_POST['first_select']; $second_select = $_POST['second_select']; $query = 'SELECT * FROM table WHERE parent_id = ' . $_POST['first_select'] AND parent_name = ' . $_POST['select_select'];//don't use it like this just an example $result = mysql_query($query, $db); ???refresh page???
-
How do I populate and refresh a second listbox based upon the choice a user makes in the first listbox? Currently this is what I'm using for my first listbox but I'm not sure how to complete the second listbox can someone help me out with this? <?php //Get list of Clients from database $query_rstClients = "SELECT DISTINCT clnt_name FROM orders ORDER BY clnt_name DESC"; mysql_select_db($database_dbconn, $dbconn); $rstClients = mysql_query($query_rstClients, $dbconn) or die(mysql_error()); $selectBox = "<select id='clientname' name = 'clientname' onchange='somefunction();'><option>Select Client</option>"; while($rec=mysql_fetch_array($rstClients)) { $selectBox = $selectBox."<option value= $rec[clnt_name]>$rec[clnt_name]</option>"; } $selectBox = $selectBox."</select>"; ?>
-
Thanks for the help. A JM,
-
Currently its using pagination but it won't be that difficult to remove and just let the recordset populate on a single page. If using CSS does it allow for page breaks when printing? Thanks.
-
Yes, printer friendly. Do you have any links to the CSS implementation? Also I assume I am to remove pagination on the "New" page? Thanks.
-
Sure sorry... In this particular instance I'm running a query against mySQL and the resultset is displayed on the page. I would like to be able to allow the end user to also print those results with a "PRINT" button or some other means. I just want to isolate the print to only the data in the resultset with headings. The resultset can have 10 records to 100 records and will vary. Thanks. A JM,
-
Does anyone know of some available script(s) for printing Dynamic Table results? I'm looking for an example or some suggestions on how to print some of my Dynamic information.. Thanks. A JM,
-
Sorry for the noise the problem was in download.php... duh! A JM,