Jump to content

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. :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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