Jump to content

[SOLVED] day and month control: it'snot working.


uisneach

Recommended Posts

Hello everybody  :)

 

Got this script connected to a form in a previos file. Like you understand, got the values froma  drop down menu

here it is:

 

inthe first file. php named Insert.php

 

 

    <select name='month'>

    <option value='10'>october</option>

    <option value='11'>november</option>

  <option value='12'>december</option>

</select>";

 

<select name='day'>

  <option value='01'>1</option>

  <option value='02'>2</option>

<option value='03'>3</option>

(......)

  <option value='29'>29</option>

  <option value='30'>30</option>

  <option value='31'>31</option>

</select>";

 

 

In the second file .php named form.php

got this (retrieve the values)

 

$day= $_POST['day'];

$month = $_POST['month'];

$year= $_POST['year'];

if ($day= "31" and $month = "11"){

 

 

echo "<p>The day does not exist!!

die();

}

else {

 

}

 

And here I will have all the script with query in db, etcc..etcc...

 

 

THE problem is that also  entering other days different from 31st november, (that does not exists), I got the same message and the correct values (like e.g. 1st october, or 20 november. etc...) are considered like being 31st of november. and everything is stopped there , and die ???

 

 

 

anyoine has aclue/idea/advice/suggestion?

 

thx in advance :)

 

Change:

 

if ($day= "31" and $month = "11"){

 

To:

 

if ($day == 31 && $month == 11){

 

I guess you got the AND from MySQL syntax. Also remember that when comparing a variable (or whatever it's called) like you do in your if-sentence, you must use double comparison operators (==, && for example). Also, in the next line, remember to close the <p> you open. :)

Archived

This topic is now archived and is closed to further replies.

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