Jump to content

Jahren

Members
  • Posts

    66
  • Joined

  • Last visited

    Never

Posts posted by Jahren

  1. Hi!

    I'm a php coding beginner onward to intermediate level :P

     

    I want to list all days between date1 and date2

    ie:

    Jan 29 2009 - Jan 30 2009 - Jan 31 2009 - Feb 1 2009 - Feb 2 2009 - etc..

     

    I can fetch my begin_date and end_date from MySQL fine but I have no clue on how to generate every day between them

     

    I want to add the days in a html select box for the user to pick one from...

     

    I though about this logic but obviously won't work at all.

    //Classe de gestion de dates, opérations arithmétiques sur des dates
    class dates_operations
    {
    	function test()
    	{
    		$begindate = date("M-d-Y", mktime (0,0,0,1,25,2009));
    		$enddate= date("M-d-Y", mktime mktime (0,0,0,2,6,2009));
    
    		$date = $begindate;
    		echo $date;
    
    		while ($date < $enddate)
    		{
    			$date = $date("j M Y", strtotime("+1 day"));
    			echo $date
    		}
    
    	}
    }
    

  2. OMG!

     

    You were right about the width!

    I didn't notice at first because I used a 300px which was larger than the available space lol

    with 250px, it fits REALLY nicely. Thank you very much

     

    I'll remove the pictures now.

    edit : I can't modify my first topic.. oh well! too bad!

  3. Setting a width to introduction makes the first picture to go left by that pixel amount for some reasons! (in firefox too)

     

    Thanks for the margin tip, I changed all of them to fit and I can tell I see a difference! (didn't fix my problem tho but thanks for the knowledge)

     

    lol your  BR tag was interpreted by the forums :P

    I'll try and do it right next time with <p> thanks. I'm learning as I go.

    People like you make my day ehe.

     

    Now I need to find out what's wrong with my design making IE crying.

  4. Hi guys!

    I might sound like a newb but.. I AM  ;D

     

    no seriously, i'm trying to have an image going to the right of a div of text..

    Works well in firefox/safari/opera but fails in IE 7

     

    Right :

    firefox-floatright.png

    Wrong :

    IE-floatright.png

     

    here's some code

     

    HTML

    <div id="introduction">	
    		<img class='img_intro' src="images/orientation/pierre_beaupré.png" alt="Pierre Beaupré">
    
    		<div id="texte_intro">
    			<h3>Pierre Beaupré</h3><br/>
    			Téléphone:   (450) 430-3120 <br/>
    			poste:       2738<br/>
    			Local : L-111-F <br/>
    			Courriel:    <a href="mailto:email@domain.com">email@domain.com</a> <br/>
    		</div>
    		<div id="clearme"></div>
    	</div>
    	<div id="introduction2">	
    		<br/>
    		<img class='img_intro2' src="images/orientation/benois_dumas.png" alt="Benois Dumas">
    
    		<div id="texte_intro2">
    			<h3>Benois Dumas</h3><br/>
    			Téléphone:   (450) 430-3120 <br/>
    			poste:       2738<br/>
    			Local : L-111-F <br/>
    			Courriel:    <a href="mailto:email@domain.com">email@domain.com</a> <br/>
    		</div>
    
    		<div id="clearme"></div>
    	</div>
    

     

    CSS

    #introduction
    {
    margin-top : -15px;
    margin-left : 15px;
    }
    
    .img_intro
    {
    width : 150px;
    height : 200px;
    margin-right : 300px;
    border : 2px solid black;
    float : right;
    }
    
    .img_intro2
    {
    width : 150px;
    height : 200px;
    margin-left : 30px;
    border : 2px solid black;
    float : left;
    }
    
    #texte_intro
    {
    margin-left : 10px;
    }
    
    #texte_intro2
    {
    margin-left : 220px;
    }
    
    #clearme
    {
    clear : both;
    }
    

     

  5. alright, here is the refined version of the script :

     

    <script type="text/javascript">
    <?php
    
    function GetComboboxIndex($Options, $Match, $Element)
    {
    	foreach($Options as $i => $val)
    	{
    		if($Match == $val)
    		{
    			return 'document.formulaire.' .$Element. '.selectedIndex = "' .$i. '";' ;
    		}
    	}
    	return '';
    }
    
    if(!$Valide)
    {
    	echo 'document.formulaire.Nom.value = "' .$_POST["LastName"]. '";' ;
    	echo 'document.formulaire.Prénom.value = "' .$_POST["FirstName"]. '";' ;
    	echo 'document.formulaire.NoAD.value = "' .$_POST["NoAD"]. '";' ;
    	echo 'document.formulaire.Courriel.value = "' .$_POST["Email"]. '";' ;
    	echo 'document.formulaire.NoTel.value = "' .$_POST["NoTel"]. '";' ;
    
    	echo GetComboboxIndex($JoursOptions,  $_POST["Day1"], 'Day1');
    	echo GetComboboxIndex($HeuresOptions,  $_POST["Hour1"], 'Hour1');
    	echo GetComboboxIndex($JoursOptions,  $_POST["Day2"], 'Day2');
    	echo GetComboboxIndex($HeuresOptions,  $_POST["Hour2"], 'Hour2');
    	echo GetComboboxIndex($JoursOptions,  $_POST["Day3"], 'Day3');
    	echo GetComboboxIndex($HeuresOptions,  $_POST["Hour3"], 'Hour3');
    
    }
    ?>
    </script>
    

  6. i'll re-adapt your code a bit with my javascript idea.

    I need to stack the option values in php array

    i'll loop them without verifying EACH time if I need to assign new values.

     

    <?php
    if(!$Valide)
    {
    	echo 'document.formulaire.Nom.value = "' .$_POST["Nom"]. '";' ;
    	echo 'document.formulaire.Prénom.value = "' .$_POST["Prénom"]. '";' ;
    	echo 'document.formulaire.NoAD.value = "' .$_POST["NoAD"]. '";' ;
    	echo 'document.formulaire.Courriel.value = "' .$_POST["Courriel"]. '";' ;
    	echo 'document.formulaire.NoTel.value = "' .$_POST["NoTel"]. '";' ;
    
    	foreach($JoursOptions as $i => $val)
    	{
    		if($_POST["Jour1"] == $val)
    		{
    			echo 'document.formulaire.Jour1.selectedIndex = "' .$i. '";' ;
    			break;
    		}
    	}
    
    }
    ?>
    

     

    and it works fine

    thanks to everyone

     

    i'll now make it as a function to accept any array with any string to find and any form element

  7. That's what I feared you'd answer :P

    Thanks. There's no way a lazy programmer like myself will write 50 lines of code for that single purpose!

    Let's make a function to find out which option needs a "selected='true'"

     

    A loop ? hmm.

    How about javascript guys? do you think it could be easier to write a javascript to assign new values to the form?

    since javascript has acces to all page's elements

  8. I'm not sure I understand it all.

    What would happen for a combobox with 50 values (that's an example)

     

    here's an easy one :

     

           <select class="label_form1 " name="Jour1">
    	<option value="Lundi">Lundi</option>
    	<option value="Mardi">Mardi</option>
    	<option value="Mercredi">Mercredi</option>
    	<option value="Jeudi">Jeudi</option>
    	<option value="Vendredi">Vendredi</option>
    </select>
    

     

    I hope you don't mean that I would need to go over all of the options and check if it's the previously selected one

  9. Hi guys!

    here comes my next question!

     

    After submitting an invalid form, a visitor could benefit from having their old inputs back into the form.

     

    <input class="label_form1" type="text" name="Prénom" <?php global $valide; if(!$Valide){echo '\'value=\'' .$_POST["Prénom"]. '\'';} ?>/><br />

    Having to do this for every single input is a hell of a work.

     

    Is there an easier way to fill the form inputs from the last POSTed values?

  10. Allrriiightt xD

    Moving the bcc statement down did it!

     

    	$from = "email@clg.qc.ca";
    	$headers = "From: $from\r\n";
    	$headers .= "To: $to\r\n";
    	$headers .= "Return-Path: <".$to.">\r\n";
    	$headers .= "MIME-Version: 1.0\r\n";
    	[b]$headers .= "Bcc:email@gmail.com\r\n";[/b]
    	$headers .= "Content-Type: text/HTML; charset=ISO-8859-1\r\n"; 
    

  11. Thanks you for your replies

     

    I did try CC, cc Cc and even cC. Same combinaison with Bcc bcc etc..

    I read on some forums that having a space after the semi-colomn could be bad. So I tried that too.

    no luck so far.

     

    i'll try moving Bcc up and down and see what it does..

     

    I have a different var for the body message which is $message. I don't mix the two. Well if that's what you meant

  12. Hi guys, my first time here so I'll drop by and say hello :P

     

    I've a question for you (DUH)

    What's wrong with my snipet of code?

    An email goes through perfectly but CC and Bcc won't get to destination.

     

                    //Message is edited above
                    $to = $_POST['Courriel'];
                    $from = "email@clg.qc.ca";
    	$headers = "From: $from\r\n";
    	$headers .= "To: $to\r\n";
    	$headers .= "bcc:email@gmail.com\r\n";
    	$headers .= "Return-Path: <".$to.">\r\n";
    	$headers .= "MIME-Version: 1.0\r\n";
    	$headers .= "Content-Type: text/HTML; charset=ISO-8859-1\r\n"; 
    	if(mail($to,$subject,$message,$headers))
    

     

    edit : removed emails XD idiot me!

×
×
  • 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.