Jump to content

urgent: forms with php


nikhar021

Recommended Posts

im designing a form in the manner

<form method="post" action="register1submit.php" >

<p> Enter your first name:                           

  <input type="text" name="first" >

</p>

 

<p>Enter your last name:

    <input type="text" name="last" >

</p>

<p> Enter last six digits of your Student ID:

    <input type="text" name="id" maxlength="6" >

</p>

<p> Enter the desired password (minimum 6 characters):

    <input type="password" name="pswd1" />

</p>

<p> Re-enter the desired password:

    <input type="password" name="pswd2">

</p>

<td>Select your BRANCH</td>

<select name="branch">

  <option value=""></option>

  <option value="CS">Computer Science</option>

  <option value="IT">Information and Technology</option>

  <option value="EC">Electronics and Communication</option>

  <option value="EI">Electronics and Instrumentation</option>

</select>

<td>Select your semester</td>

<select name="semester">

  <option value=""></option>

  <option value="1">1st</option>

  <option value="2">2nd</option>

  <option value="3">3rd</option>

  <option value="4">4th</option>

  <option value="5">5th</option>

  <option value="6">6th</option>

  <option value="7">7th</option>

  <option value="8">8th</option>

</select>

<font style=" color:#FFFFFF; font-family:Comic Sans MS, Georgia; font-size: 18px">

<?echo"<br><br><br>PERSONAL DETAILS"?>

</font>

<p>Enter your Father's Name:

  <input type="text" name="fname" />

</p>

<p>Enter your Mother's Name:

  <input type="text"  name="mname" />

</p>

<p>Address Line 1:

  <input type="text" name="add1" />

</p>

<p>Address Line 2:

  <input type="text" name="add2" />

</p>

<td>City</td>

    <select name="city">

    <option value="Anuppur">Anuppur</option>

<option value="Ashoknagar">Ashoknagar</option>

<option value="Balaghat">Balaghat</option>

<option value="Barwani">Barwani</option>

<option value="Betul">Betul</option>

<option value="Bhind">Bhind</option>

<option value="Bhopal">Bhopal</option>

<option value="Burhanpur">Burhanpur</option>

<option value="Chhatarpur">Chhatarpur</option>

<option value="Chhindwara">Chhindwara</option>

<option value="Damoh">Damoh</option>

<option value="Datia">Datia</option>

<option value="Dhar">Dhar</option>

<option value="Dindori">Dindori</option>

<option value="Guna">Guna</option>

<option value="Gwalior">Gwalior</option>

<option value="Harda">Harda</option>

<option value="Hoshangabad">Hoshangabad</option>

<option value="Indore">Indore</option>

<option value="Jabalpur">Jabalpur</option>

<option value="Jhabua">Jhabua</option>

<option value="Katni">Katni</option>

<option value="Khandwa">Khandwa</option>

<option value="Khargone">Khargone</option>

<option value="Mandsaur">Mandsaur</option>

<option value="Morena">Morena</option>

<option value="Narsinghpur">Narsinghpur</option>

<option value="Neemuch">Neemuch</option>

<option value="Panna">Panna</option>

<option value="Raisen">Raisen</option>

<option value="Rajgarh">Rajgarh</option>

<option value="Rewa">Rewa</option>

<option value="Sehore">Sehore</option>

<option value="Seoni">Seoni</option>

<option value="Shahdol">Shahdol</option>

<option value="Sheopur">Sheopur</option>

<option value="Shivpuri">Shivpuri</option>

<option value="Sidhi">Sidhi</option>

<option value="Singrauli">Singrauli</option>

<option value="Tikamgarh">Tikamgarh</option>

<option value="Umaria">Umaria</option>

<option value="Vidisha">Vidisha</option>

</select>

 

<p> State:

    <input type="text" name="state">

</p>

 

<p> Pin Code:

    <input type="text" name="pin">

</p>

<p> Contact Number:       

  <input type="text" name="no">

</p>

<p>Enter your email address:

  <input type="text" name="email">

</p>

<p>

  <center><input type="submit" name="submit" value="submit"></center>

</p>

 

 

 

 

but the problem is that all the fields appear in an unaligned manner.

how can i align them to give a proper formal look???????????

Link to comment
Share on other sites

This is NOT a PHP problem. this is an HTML and/or CSS problem. I would suggest building your forms in ONLY HTML/CSS. Once they look correct, then incorporate the PHP code needed for the variability and functionality needed.

 

however, the easiest solution to your problem would be to use a table. (although many would suggest that CS is the proper solution). I also see no need for each field label to state "Enter your...". That's kind of implied by the fact that you have a form, is it not?

 

Here's a quick rewrite:

<form method="post" action="register1submit.php" >
<table>
  <tr><td>First name:</td><td><input type="text" name="first" /></td></tr>
  <tr><td>Last name:</td><td><input type="text" name="last" /></td></tr>
  <tr><td>Last six digits of your Student ID:</td><td><input type="text" name="id" maxlength="6" /></td></tr>
  <tr><td>Password (minimum 6 characters):</td><td><input type="password" name="pswd1" /></td></tr>
  <tr><td>Re-enter password:</td><td><input type="password" name="pswd2" /></td></tr>
  <tr>
    <td>BRANCH</td>
    <td>
      <select name="branch">
        <option value=""></option>
        <option value="CS">Computer Science</option>
        <option value="IT">Information and Technology</option>
        <option value="EC">Electronics and Communication</option>
        <option value="EI">Electronics and Instrumentation</option>
      </select>
    </td>
  </tr>
  <tr>
    <td>Semester</td>
    <td>
      <select name="semester">
        <option value=""></option>
        <option value="1">1st</option>
        <option value="2">2nd</option>
        <option value="3">3rd</option>
        <option value="4">4th</option>
        <option value="5">5th</option>
        <option value="6">6th</option>
        <option value="7">7th</option>
        <option value="8">8th</option>
     </select>
    </td>
  </tr>

  <tr>
    <td colspan="2">
      <font style=" color:#FFFFFF; font-family:Comic Sans MS, Georgia; font-size: 18px">PERSONAL DETAILS</font>
    </td>
  </tr>

  <tr><td>Father's Name:</td><td><input type="text" name="fname" /></td></tr>
  <tr><td>Mother's Name:</td><td><input type="text"  name="mname" /></td></tr>
  <tr><td>Address Line 1:</td><td><input type="text" name="add1" /></td></tr>
  <tr><td>Address Line 2:</td><td><input type="text" name="add2" /></td></tr>

  <tr>
    <td>City</td>
    <td>
      <select name="city">
        <option value="Anuppur">Anuppur</option>
        <option value="Ashoknagar">Ashoknagar</option>
        <option value="Balaghat">Balaghat</option>
        <option value="Barwani">Barwani</option>
        <option value="Betul">Betul</option>
        <option value="Bhind">Bhind</option>
        <option value="Bhopal">Bhopal</option>
        <option value="Burhanpur">Burhanpur</option>
        <option value="Chhatarpur">Chhatarpur</option>
        <option value="Chhindwara">Chhindwara</option>
        <option value="Damoh">Damoh</option>
        <option value="Datia">Datia</option>
        <option value="Dhar">Dhar</option>
        <option value="Dindori">Dindori</option>
        <option value="Guna">Guna</option>
        <option value="Gwalior">Gwalior</option>
        <option value="Harda">Harda</option>
        <option value="Hoshangabad">Hoshangabad</option>
        <option value="Indore">Indore</option>
        <option value="Jabalpur">Jabalpur</option>
        <option value="Jhabua">Jhabua</option>
        <option value="Katni">Katni</option>
        <option value="Khandwa">Khandwa</option>
        <option value="Khargone">Khargone</option>
        <option value="Mandsaur">Mandsaur</option>
        <option value="Morena">Morena</option>
        <option value="Narsinghpur">Narsinghpur</option>
        <option value="Neemuch">Neemuch</option>
        <option value="Panna">Panna</option>
        <option value="Raisen">Raisen</option>
        <option value="Rajgarh">Rajgarh</option>
        <option value="Rewa">Rewa</option>
        <option value="Sehore">Sehore</option>
        <option value="Seoni">Seoni</option>
        <option value="Shahdol">Shahdol</option>
        <option value="Sheopur">Sheopur</option>
        <option value="Shivpuri">Shivpuri</option>
        <option value="Sidhi">Sidhi</option>
        <option value="Singrauli">Singrauli</option>
        <option value="Tikamgarh">Tikamgarh</option>
        <option value="Umaria">Umaria</option>
        <option value="Vidisha">Vidisha</option>
      </select>
    </td>
  </tr>

  <tr><td>State:</td><td><input type="text" name="state" /></td></tr>
  <tr><td>Pin Code:</td><td><input type="text" name="pin" /></td></tr>
  <tr><td>Contact Number:</td><td><input type="text" name="no" /></td></tr>
  <tr><td>Email address:</td><td><input type="text" name="email"></td></tr>
  <tr><td align="center" colspan="2"><input type="submit" name="submit" value="submit"></td></tr>
</table>

Link to comment
Share on other sites

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.