Hello to all,


I need your help,,,I m beginner of the php...

i have to generate a user id for register users & it depends upon the batch field,,


<option <?php if(($batch)=="1983-86")echo "selected";?>>1983-86</option>
<option <?php if(($batch)=="1984-87")echo "selected";?>>1984-87</option>
<option <?php if(($batch)=="1985-88")echo "selected";?>>1985-88</option>
<option <?php if(($batch)=="1986-89")echo "selected";?>>1986-89</option>


i need to select batch="1983-86" , year 1983 last 2 digits... that means

83001,83002,83003.....etc like this i need to generate please help me.........

Do you need this in a database table, or in PHP ?

In PHP, to get the last 2 digits of the year code you would use substr as such:

$lasttwodigits=substr($batch, 2, 3)

This will give you the 8 and 3 out of 1983, then you just add on the trailing digits (not sure if you need help on that part)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.