
fortnox007
Members-
Posts
783 -
Joined
-
Last visited
Never
Everything posted by fortnox007
-
I doubt that. Javascript is client side. I assume although - I have no exact idea on how to yet - you insert the javascript on the page where the user is present. That javascript uses the time it receives from a database or a text file. Maybe Ajax is something to look in further. That way your client doesn't needs to refresh it's browser, but the stuff just happends 'realtime'.
-
Newbie Trying to get my head around Web Forms!
fortnox007 replied to racercam's topic in PHP Coding Help
Also here i would just test out the mail function itself, ones your familiar with it, integrate it in your form. that way it's easier to isolate any problems if they may occur. -
maybe have a look in this http://24ways.org/2005/transitional-vs-strict-markup just a quote from that article:
-
no problemo I can really recommend netbeans, I use it in combination with xampp (10 min. easy setup) and it works like a charm. I also noticed you use <br> it should be <br /> and don't forget the /> at the end of your input fields. Just compare your code and mine and you see what I mean. best of luck!
-
I am pretty sure if you read what i wrote above here you should have been able to do so but it seems comfort is more appreciated. XD by the way what editor are you using your code is missing loads of endtags!. download netbeans and use it!! I would appreciate it if you would put some effort in this yourself. anyways here is a ready made code: <!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>lazy people's form</title> </head> <body> <h1>lazy people never get rich</h1> <?php //define your conditional variables above the heredoc (exactly as i told!) $user = 'user'; $pass = 'pasword'; $your_error_user = 'lalala'; $your_error_user = 'lalalalalala'; $your_conditional_value = 'whatever'; // you can put an if-statement infront of this //starting of your heredoc (exactly as i told!!) $str = <<<DEMO <form action="process.php" method="POST"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="$user" /></td><td>$your_error_user</td></tr> <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="$pass" /></td><td>$your_error_pass</td></tr> <tr><td colspan="2" align="left"><input type="checkbox" name="remember" value="$your_conditional_value" /> <font size="2" />Remember me next time <input type="hidden" name="sublogin" value="1" /> <input type="submit" value="Login" /></td></tr> <tr><td colspan="2" align="left" ><br /><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr> </table> </form> DEMO; //I hope next time you read more carefuly in the comments!! ?> </body> </html>
-
I bet that's because your using <?php and ?> inside the heredoc. just use $var instead of <?php echo $var; ?> -edit: i haven't tested it, but i would also put the conditional stuf above the heredoc and only use plain variables in the herdoc itself, i am pretty sure the -> signs won't work inside it. Well i assume you know how to do that
-
XD looking is not trying. heredoc just is a nice way to but crap loads of html without using all echoes and stuff. exactly as the example on the page i linked shows: <?php $name = "Max"; $str = <<<DEMO Hello $name! <br/> This is a demo message with heredoc. DEMO; //make sure this mark touched the sideline!!! echo $str; ?>
-
did you try the heredoc?? another way could be to do something like this <?php if (1==1){ ?> <form action="process.php" method="POST"> <table align="left" border="0" cellspacing="0" cellpadding="3"> <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<?php echo $form->value("user"); ?>"></td><td><?php echo $form->error("user"); ?></td></tr> <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<?php echo $form->value("pass"); ?>"></td><td><?php echo $form->error("pass"); ?></td></tr> <tr><td colspan="2" align="left"><input type="checkbox" name="remember" <?php if($form->value("remember") != ""){ echo "checked"; } ?> <font size="2">Remember me next time <input type="hidden" name="sublogin" value="1"> <input type="submit" value="Login"></td></tr> <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr> </table> </form> <?php } ?>
-
Newbie Trying to get my head around Web Forms!
fortnox007 replied to racercam's topic in PHP Coding Help
make sure to get Netbeans, while typing it gives hints and it's way better than those so claimed customer friendly bulcrap editors. This way you understand how to reproduce stuff instead of relying on others. Love to see your example and will help you get the basics understood. good luck! -
i don't really understand what you mean. Do you want to echo out that whole bit like a string value or something? heredocs could be worth looking in: http://www.phpf1.com/tutorial/php-heredoc-syntax.html
-
insert data from one website to another website
fortnox007 replied to fer0an's topic in PHP Coding Help
i have no idea what the naming protocol is, maybe ask the host in question? or maybe some real guru around here has an idea. This though might be worth a try, it could be that your priviliges need to be fixed: http://forums.mysql.com/read.php?108,62926,114663#msg-114663 -
would this help you? $string = '100.000.000 zilion trillion billion euros'; $pattern = '/[^0-9]/i'; $replacement = ''; echo preg_replace($pattern, $replacement, $string); // this will output 100000000 Put your code in code tags btw much easier to read it
-
insert data from one website to another website
fortnox007 replied to fer0an's topic in PHP Coding Help
$dbhost = "localhost"; i bet this is the troublemaker edit: maybe also want to just paste your error in google: a forum dealing with this same error is: http://drupal.org/node/129982 -
insert data from one website to another website
fortnox007 replied to fer0an's topic in PHP Coding Help
It should be no different that a normal database connection within the same domain except for instead of using 'localhost' you use the external host. -
Newbie Trying to get my head around Web Forms!
fortnox007 replied to racercam's topic in PHP Coding Help
Well the thing is you didn't post it, so it's a pretty visionary task to judge/solve that one. So if you post that script (in the code tags please) and say what you are expecting and what you have so far if there are any errors etc. so we have something to work with. Also i would recommend first start with the basics. Don't ask others to solve you're stuff and deliver a finished product, you don't learn anything from that. Read this easy to follow guide on forms: http://www.tizag.com/phpT/forms.php after that you should be able to make a very simple form just like I suggested. Not with all the fancy classes you have now. just something with a name field and a message field that you send to another page. Ones you know how to do that it's easy to fix the stuff you have yourself trust me. I could also to recommend to get Netbeans (php version). its a free editor that helps to write sound code. I have the impression your using some wicked editor now that doesn't contribute in your learning curve. -
mark it solved before its too late and the aliens abduct you! :o
-
your missing one after your close connection too
-
notice though my code is a bit redundant, (i did that of course from a teacher perspective lolzors) it would have been better to set a class as variable, Like: if ($time == 'lalala'){ $class = 'day'; }else{ $class = 'night'; }// and put this class var in your loop in the element tag or whatever you want. // like echo '<div class="'.$class.'"> lalalalalala </div>'; that way you only need 1 foreach()-loop instead of 2. Idea of css html and php stays the same though. Nice thing too is that you can sell this to your client in case they have a special event. just make a nice css for it and php does the rest.
-
I could really recommend to set a class or id with php and use an external stylesheet (instead of what i see very often here in-line style). that way you keep things nicely separated and it's easy to switch styles. But if you rather have in-line style (which sneaky let's you duplicate your code more) the result (view) will be the same for instance a day and night concept: css file could look like this: .night { color: white; background-color: black; } .day{ color: blue; background-color:white; } php code could look like this $time = 'day'; //don't use this of course as a time indicator ;-) $my_array = array(2,4,6,8,10); // just a random array to created some output if ($time == 'day'){ // in case it's day foreach($my_array as $key => $value){ echo '<p class="day">any thing you like can be put inside here ('.$value.')(day) <p>'; } }else{ // in case of night foreach($my_array as $key => $value){ echo '<p class="night">any thing you like can be put inside here ('.$value.')(night) </p>'; } } I haven't tested it but I hope you see the Idea. if not let me know and ill try to clarify more. -edit: i just tested it and it works -edit2: changed the css a bit , they were the same. day now has a white background and blue font color, and night black background white font color
-
Newbie Trying to get my head around Web Forms!
fortnox007 replied to racercam's topic in PHP Coding Help
Well first of all, i would start of separating your CSS from you code. in-line style makes it hard (chaotic) to read besides that it is not a very nice practise. external stylesheets are much easier and faster to maintain. Than i would just make a simple version of a form that just sends a little info instead of a huge file with a greater chance of making mistakes. If you can do the simple 'small' one you can do the big one. That way it's easier to isolate the problem, and easier for us to solve. Third post your code in code tags, this isn't fun to read at all. -
Just to show you can, test this script: $_POST['monkeyballs']='lalala'; print_r($_POST); // outputs: Array ( [monkeyballs] => lalala ) unset($_POST['monkeyballs']); print_r($_POST); //outputs: Array ( )
-
I bet it's possible just do print_r ($_POST); before and after and look at the output. It will show the elements in the array $_POST
-
I think you can strip some stuff from your regex /^[0-9]{4}$/ i is not needed, numbers are not case sensitive. the * is not needed (maybe even confusing) more cases can be found by preg_match_all this regex doesn't allow any other characters than 0-9 but i assume you want that. Does this help you? IF you want a certain range like starting from 1900 let me know
-
Hi there, I am not sure if the following is the reason for it's looks but here goes my thought: your original image has the dimensions 349x118 and the created one 129x43 This isn't the correct if you would like to keep the original dimensions: assuming the following. Width: 349px | 129px ---=--------=---- 100% | 36.9627507% Height: 129px | 44px ---=--------=---- 100% | 37.28813559322% <---------- this is almost 0.4 % more than the percentage of the width. as you can see the width and height differ in percentages assuming the starting point is 100 % in other words your dimensions aren't correct. without looking at the code (because I am not this far in php) this probably is caused by rounding numbers I am not sure how to do this yet in php, but I would try to get either a max width or a max height in pixels and use the percentage of that amount in adjusting the other dimension. That way you can still get the result you like within your design (which is either limited by height or width) without losing quality
-
Thanks a lot Salathe for the tips! Sorry if my question was a bit noobish, but i am not yet that experienced with this and rather know more than less. Cheers!