-
Posts
960 -
Joined
-
Last visited
Posts posted by Destramic
-
-
define("FILE_UPLOAD_TYPES", array('image/gif'));
i want to have this variable as a array so i can basically check when people upload if that certain file type is permitted.
[code]
if (!in_array('image/gif', FILE_UPLOAD_TYPES))
{
echo "file not allowed";
}
[/code]
but it doesnt seem to work...are you not able to sore array's in a define varable?
thanks ricky -
i made this script to rest field...so even if a field vaule = "something!" then it will still reset it..but it doesnt work for type = "file" anyone help?
[code]
<script>
function reset_form(the_form)
{
if (confirm("Are you sure you want to reset this form?\n Note: All entered data will be lost in the process."))
{
var elements = the_form.elements;
for (var i = 0; i < elements.length; i++)
{
var element = elements[i];
var type = element.type;
if (type && element.value !== null)
{
switch (type)
{
case "select-one":
element.selectedIndex = -1;
break;
case "text":
case "textarea":
case "password":
case "file":
element.value = "";
break;
}
}
}
}
}
</script>
<input id="file_upload" name="file_upload" type="file" class="file" value="" />
[/code]
-
thank you very much :D
-
well i have a table called 'games'
------------------
game_id
name
icon (will be saved as /images/icons/"game_id".gif)
-----------------
so i need to get the next autoindex of the game before it has been inserted so i can insert the icon uri...?
thanks ricky -
thanks mate that great
-
nope that wouldnt work...would just be like using
[code]
mysql_num_rows() + 1;
[/code]
basically if there has been 10 entries to the database and you've deleted the 2 recent entries, then mysql_num_rows would return 8 which infact i would need it to return the next index which would be 11.
hope someone can help ?
thanks ricky -
easy question...i have just a general button...when it is clicked i want it to to a certian uri eg.
google.com
maybe a onclick function? i cant fingure it out.
[code]
<input type="button" class="button" id="preview_button" name="preview_button" value="Preview" title="Preview" />
[/code]
thanks ricky -
just wondering how i could get the next Autoindex of a table?
thanks ricky -
basically for all operating systems..just to check that the file they have selected from
<input type=file /> is accually a dir...hope this helps...should i use dirname? -
just to regex a dir path
-
wondring if someone could help me regex a dir in general:
eg: D:\www\images\read.gif
thanks destramic -
yea i need to get a value from a form input field and use it in another window...can you help?
-
i have button that opens a new window...in that window is a form...when submitted i want the open window to close...but im wondering how do i get the values from that open window of a input field into my webpage?
i know this can be done...
thanks ricky -
bit of weird questions
1. but when selecting rows from the database, other than using the primary key(id number) is there anyway of getting the row number?
like mysql_insert_id; in a way but to get the number while your fetching the rows..?
2. is there a mysql function that has the array of the columns you wish to fetch..ie:
[code]
$query = "SELECT news_id,
author,
DATE_FORMAT(date, '%d/%m/%y %r ') AS date,
status
FROM news
ORDER BY news_id ASC
LIMIT ".$from.", ".$limit."";
[code]
and to have a function that calls back array('news_id', 'author', 'date', 'status')
but only the selected columns and not the whole lot from the table.
hope someone can help thanks..[/code][/code] -
good idea...thanks
-
k well maybe i should update my validation script...
-
bah sorry thats not possible it have to be $_SERVER['PHP_SELF'] as i have a form validation class that runs on the same page..
here is the code if you wanna have a quick look...you may understand better:
code: http://rafb.net/p/sbPyde45.html
page: http://82.45.55.177/cp/news_add.php
i need to be able to do a include or header location...
thanks for your quick reply ricky -
i have a form when you submit the form i want it go to add.php where all my querys for ever query insert.
problem is when i use any one of these functions...it will not carry over the $_POST array so i have no value for the array.
anyone know how i could solve this please?
[code]
if (!isset($_POST['submit']))
{
// i could simply put the query here but wouldnt be benificial.
header("Location: add.php?type=news");
//require_once $document_root . "cp/add.php?type=news";
}
[/code]
thanks ricky -
ok thanks for that :D
destramic -
im just having problems getting the result with addedslashes without using print_r();
as you can see if you run script and echo $b -
ive been working on one..this may help you out one function for it all :D
[code]
<SCRIPT>
var checkbox_state = true;
function toggle_checkboxes(the_form)
{
var button = document.getElementById("toggle_checkboxes");
var elements = the_form.parentNode.elements;
for (var i = 0; i < elements.length; i++)
{
var element = elements[i];
var type = element.type == "checkbox";
if (type)
{
element.checked = checkbox_state;
}
}
if (checkbox_state)
{
checkbox_state = false;
button.innerHTML = "<b>Unselect All</b>";
}
else
{
checkbox_state = true;
button.innerHTML = "<b>Select All</b>";
}
}
</SCRIPT>
<META content="MSHTML 6.00.2900.2995" name=GENERATOR></HEAD>
<BODY>
<FORM id=edit_remove name=edit_remove action=page.php method=post>
<INPUT class=check id=row[] type=checkbox value=Yes name=1><BR>
<INPUT class=check id=row[] type=checkbox value=Yes name=2><BR>
<INPUT class=check id=row[] type=checkbox value=Yes name=row[]><BR>
<INPUT class=check id=row[] type=checkbox value=Yes name=row[]><BR>
<INPUT class=check id=row[] type=checkbox value=Yes name=row[]><BR>
<div id="toggle_checkboxes" onclick="toggle_checkboxes(this);"><b>Select All</b></div>
</FORM>
[/code] -
im having trouble with this addslashes wrapper....basically if i addslashes to a string/array all commas will have a slash infront of it. So when i call the variable after running it through the function it should have a slash if needed. but when variable is called it has no slash...you can only see the slash when using print_r();
it will work this way...but i should have to do it like that?[code]$b = add_slashes($b);[/code]
can anyone help please? (here is the script below..)
[code]
<?php
function add_slashes($value)
{
// Check if string exists
if (is_string($value))
{
return addslashes($value);
}
elseif (is_array($value))
{
return array_map('add_slashes', $value);
}
}
$a = array(0,"This's an string's","This's an string's",array("This's an string's",array("This's an string's","This's an string's")),"This's an string's","This's an string's");
print_r( add_slashes($a));
$b = "This's an string's";
print_r( add_slashes($b));
// If i was to echo $b it would echo This's an string's without slashes? why
echo $b;
?>
[/code]
thank you destramic -
anyone know why the function works but when i call $_POST['name'] it doesnt have a slash added
-
ive gotten it to work now using:
[code]
$_POST = add_slashes($_POST);
[/code]
but when data is in the database..it doesnt have any slashes now..
empty input type file
in Javascript Help
Posted