drisate
Members-
Posts
805 -
Joined
-
Last visited
Everything posted by drisate
-
[SOLVED] Question about HTML vs PHP for FORM Action
drisate replied to fatmikey's topic in PHP Coding Help
Hmm this is bad coding bro hehe You don't need to make an error page for every errors. Give me a few min and i will recode all of it hehe -
Yeah this is strange because no matter how long i look at the code i simply don't see where i am wroung ...
-
The class you are using does nothing else then give the value you give here you are starting the class $a = new my_class; Here your giving him a value to play with $a->my_value = 5; (return teh same value This row does nothing $global_obj->my_value = 10; this row echos the value you gave to the class echo $a->my_value; :-)
-
[SOLVED] Question about HTML vs PHP for FORM Action
drisate replied to fatmikey's topic in PHP Coding Help
Yes as long as your page extention is .php This is what makes PHP so special :-) -
The best way would be when you insert in in the database ... becase to much operations (Ex: bbcode) when printing out the code slows the page when you have a lot of comments to show.
-
I am sort of doing the same thing ... But what i am working on is this <input id="file" style="BACKGROUND-COLOR: #ddeeee" type="file" size="55" name="userfile[]1"> <input id="file" style="BACKGROUND-COLOR: #ddeeee" type="file" size="55" name="userfile[]1"> <input id="file" style="BACKGROUND-COLOR: #ddeeee" type="file" size="55" name="userfile[]1"> <input id="file" style="BACKGROUND-COLOR: #ddeeee" type="file" size="55" name="userfile[]1"> <input id="file" style="BACKGROUND-COLOR: #ddeeee" type="file" size="55" name="userfile[]1"> then foreach($_FILES['userfile']['tmp_name'] as $key => $value){ // [...] // $_FILES['userfile']['tmp_name'][$key] // $_FILES['userfile']['name'][$key] // [...] }
-
Not 100% sur i understand what you are saying but you can loop the array and insert them one by one foreach ($players as $value){ // INSERT the stuff $insert = mysql_query("INSERT INTO table (id) VALUE ('$value')") or die (mysql_error()); }
-
Yeah the $_FILES is not empty echo '<pre>'; print_r($_FILES); echo '</pre>'; Array ( [userfile] => Array ( [name] => Array ( [0] => [1] => patangel.jpg [2] => patangel.png [3] => Picture 1.jpg ) [type] => Array ( [0] => [1] => image/pjpeg [2] => image/x-png [3] => image/pjpeg ) [tmp_name] => Array ( [0] => [1] => /tmp/phpITuenD [2] => /tmp/phpDVBoEJ [3] => /tmp/phpQ3phKT ) [error] => Array ( [0] => 4 [1] => 0 [2] => 0 [3] => 0 ) [size] => Array ( [0] => 0 [1] => 66131 [2] => 160980 [3] => 102651 ) ) ) Mail is sent!
-
[SOLVED] Question about HTML vs PHP for FORM Action
drisate replied to fatmikey's topic in PHP Coding Help
Of corse you can mixe. You just need to follow 2 rules 1. PHP code must bigin with <?php and finish with ?> 2. The file must use the extention .php You can put any coding outside of <?php and ?> as long as it stuff you would normaly put inside a .htm, html, xml, xhtml, dhtml ... -
Yeah the server is set ok because my upload scripts works in my other websites I cheked anyway and it is.
-
Yeah i am heres what my code looks like. It's basacly a Gmail attachement like form ... you can add or remove attachement boxes. Works like a charme ... it's really just the processing part that is causing me troble <?xml version="1.0"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr" > <head> <meta name="robots" content="index, follow" /> <meta name="keywords" content="BlessingStairs" /> <meta name="description" content="BlessingStairs" /> <meta name="generator" content="Microsoft FrontPage 5.0" /> <title>Welcome to the Frontpage</title> <link href="/index.php?format=feed&type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0" /> <link href="/index.php?format=feed&type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0" /> <link href="/templates/theme176/favicon.ico" rel="shortcut icon" type="image/x-icon" /> <script type="text/javascript" src="/includes/js/joomla.javascript.js"></script> <script type="text/javascript" src="/media/system/js/mootools.js"></script> <script type="text/javascript" src="/media/system/js/caption.js"></script> <link type="text/css" rel="stylesheet" href="/templates/theme176/css/board.css" /> <script type="text/javascript" src="/plugins/editors/tinymce/jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ theme : "advanced", language : "en", mode : "textareas", gecko_spellcheck : "true", editor_selector : "mce_editable", document_base_url : "/", entities : "60,lt,62,gt", relative_urls : 1, remove_script_host : false, save_callback : "TinyMCE_Save", invalid_elements : "applet", extended_valid_elements : "a[class|name|href|target|title|onclick|rel],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],,hr[id|title|alt|class|width|size|noshade]", theme_advanced_toolbar_location : "top", theme_advanced_source_editor_height : "550", theme_advanced_source_editor_width : "580", directionality: "ltr", force_br_newlines : "true", force_p_newlines : "false", content_css : "/templates/system/css/editor.css", debug : false, cleanup : true, cleanup_on_startup : true, safari_warning : false, plugins : "advlink, advimage, searchreplace,insertdatetime,emotions,media,advhr,table,fullscreen,directionality,layer,style", theme_advanced_buttons1_add : "fontselect", theme_advanced_buttons2_add : "search,replace,insertdate,inserttime,emotions,media,ltr,rtl,insertlayer,moveforward,movebackward,absolute,forecolor", theme_advanced_buttons3_add : "advhr,tablecontrols,fullscreen,styleprops", theme_advanced_disable : "help", plugin_insertdate_dateFormat : "%Y-%m-%d", plugin_insertdate_timeFormat : "%H:%M:%S", fullscreen_settings : { theme_advanced_path_location : "top" } }); function TinyMCE_Save(editor_id, content, node) { base_url = tinyMCE.settings['document_base_url']; var vHTML = content; if (true == true){ vHTML = tinyMCE.regexpReplace(vHTML, 'href\s*=\s*"?'+base_url+'', 'href="', 'gi'); vHTML = tinyMCE.regexpReplace(vHTML, 'src\s*=\s*"?'+base_url+'', 'src="', 'gi'); vHTML = tinyMCE.regexpReplace(vHTML, 'mce_real_src\s*=\s*"?', '', 'gi'); vHTML = tinyMCE.regexpReplace(vHTML, 'mce_real_href\s*=\s*"?', '', 'gi'); } return vHTML; } </script> <link rel="stylesheet" href="/administrator/templates/system/css/system.css" type="text/css" /> <link href="/administrator/templates/khepri/css/template.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="/uploads.css" type="text/css" /> <script type="text/javascript" src="/uploads.js"></script> <link rel="stylesheet" href="/templates/theme176/css/template.css" type="text/css" /> <link rel="stylesheet" href="/templates/theme176/css/constant.css" type="text/css" /> <link rel="stylesheet" href="/templates/theme176/css/style.css" type="text/css" /> </head> <body> <div class="comp-cont"> <form action='index.php?mod=mail&CMD=send' enctype='multipart/form-data' method='post'> <input type='hidden' name='fr' value='patrick@blessingstairs.org'> <input type='hidden' name='MAX_FILE_SIZE' value='2480000021'> <table border='0' cellpadding='3' cellspacing='3' width='100%'> <tr> <td width='105'>Attachment:</td> <td><div id="attachment" class="attachment" style="display:none"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1"> <tr> <td width="100%"> <input id="file" name='userfile[]' style="background-color: #ddeeee;"type="file" type='file' size="55"> <a href="#" onclick="javascript:removeFile(this.parentNode.parentNode,this.parentNode);">remove</a></td> </tr> </table> </div> <div id="attachments" class="container"><br/><a id="addupload" href="javascript:addUpload(10, 'desc', 'file')"> <img src='/images/trombone2.png' width="30" height="30"> Click here to attach a file</a><br/><br/> <span id="attachmentmarker"></span> </div> </td> </tr> </table> </form> </div> </body> </html>
-
Yeah from what i know the r is ok ... i really don't get it because the Attach($AttmFile, $FileName) function comes from a working webmail so it should normaly work ... (it does on the other webmail) ... So the problem is moste likly from the processing before that foreach($_FILES['userfile']['tmp_name'] as $key => $value){ if (is_uploaded_file($_FILES['userfile']['tmp_name'][$key])) { Attach($_FILES['userfile']['tmp_name'][$key],$_FILES['userfile']['name'][$key]); } } the imput boxes are like this <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> <input id="file" name="userfile[]" style="background-color: rgb(221, 238, 238);" size="55" type="file"> [...] The email is sent but not the attachements
-
The only thing you need to do is to load the time from the URL of where you are and insert it into the select querry by the way i made an error its LIMIT 0 , 2 lol and to load your stuff the code would look like <?php if ($_GET[$x]){ //bigger then $operation = "x>'$_GET[$x]'"; // OR //Smaller then $operation = "x<'$_GET[$x]'"; // Choose what you prefer } $i = 0; $transaction = mysql_query("SELECT * FROM para1 where $operation ORDER BY `updated_at` DESC LIMIT 0 , 1") or die (mysql_error()); while($trans = @mysql_fetch_array($transaction)){ if ($i = "0"){ //oldest }else{ // newest } $i++;} // Now that every vars are loaded do your page as normal and use the vars you initiated ?>
-
lol 2 topics on the same subject hehe this is what i posted in the other one <html> <head> <title>Test</title> <?php if($_POST['username'] == NULL){?> <script language="javascript"> function MyFormSubmit(){ document.myname.submit(); } </script> <?php } ?> </head> <body onload="MyFormSubmit()"> <FORM ACTION="http://localhost/test.php" METHOD="POST" name="myname" id="myname"> <INPUT TYPE="HIDDEN" NAME="username" id="username" VALUE="latheesan"> </FORM> </body> </html>
-
[SOLVED] Question about HTML vs PHP for FORM Action
drisate replied to fatmikey's topic in PHP Coding Help
Nah that would not load on page load it would look a lot more like this <html> <head> <title>Test</title> <?php if($_POST['username'] == NULL){?> <script language="javascript"> function MyFormSubmit(){ document.myname.submit(); } </script> <?php } ?> </head> <body onload="MyFormSubmit()"> <FORM ACTION="http://localhost/test.php" METHOD="POST" name="myname" id="myname"> <INPUT TYPE="HIDDEN" NAME="username" id="username" VALUE="latheesan"> </FORM> </body> </html> -
no the trick is to do it befor ... This is something i did for an IPN script 1. build the forme and make it submit to a php page on your server 2. the php page receives the info ... save the stuff to a database 3. while doing it theres a message saying please whait while we transfer you 4. when it's done you build a hidden forme and auto submit it to the processor 5. the processor posts back the info to your IPN script 6. using the custome var features of your IPN you track down the row where the info is stored 7. You update the status with (complete, uncompleted) or just 1 or 0 for short
-
Why not just do this? <?php if ($_GET[check]){ if (isset($_GET['image'])) { $path = "proofs/{$_GET['image']}.jpg"; if (file_exists($path)) { //we're good printf('<div><p>Here is your photo for proofing:<p><img src="%s" alt=""/></div>', htmlentities($path, ENT_QUOTES)); echo "Send your sales excecutive an email to confirm that your proof is OK to proof.<p>If you wish to proof another design please input the password below. "; } else { echo "<p>Image could not be found, please try again.</p>"; } } }else{ echo "You did not check the check boxe"; } //redisplay form anyway since it's easier than having to go back every time ?> <p>To save time we allow you to proof your designs online by entering your password in the form field below.</p> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> <p> <input type="text" name="image" size="20" /> </p> <p> <input type="checkbox" name="check" value="ON"> click here for blah ...</p> <p> <input type="submit" value="Submit" /> </p> </form>
-
Yeah you could LIMIT 0 , 2 and load loop mysql_fetch_array so you get the stuff of ID#2 and ID#1 then use them like you need in your page $i = 0; $transaction = mysql_query("SELECT text FROM para1 ORDER BY `updated_at` DESC LIMIT 0 , 1") or die (mysql_error()); while($trans = @mysql_fetch_array($transaction)){ if ($i = "0"){ //oldest }else{ // newest } $i++;} // Now that every vars are loaded do your page as normal and use the vars you initiated
-
Yeah :-) And you can also use the pow(x,y) function to do that
-
lol you just need to echo $i bro and you will find out hehe echo 16 << 4;
-
No that would be a JavaScript syntaxes. PHP is parsed before HTML. When the page is loaded the PHP is static and can't do stuff dynamically unless you use AJAX
-
You would do that using JavaScript document.myform.submit(); For more info go on the JavaScript board ;-)