Jump to content

[SOLVED] forward slashes in form fields ie. <input type="text" name="name" />


eMonk

Recommended Posts

since i have started learning php.. i have noticed in their form fields they add a forward slash before ending their input fields, for example, <input type="text" name="name" />

 

is the forward slash "/" needed at the end when passing form values to php? if so, why?

 

i believe i have excluded these in the past without any noticable problems.

 

also.. would the forward slash be needed here?

 

<select name="select1">

<option>PHP</option>

<option>MySQL</option>

</select>

 

thanks in advance to anyone that can shed some light on this issue!

Link to comment
Share on other sites

oh i see... thanks for clearing that up!

 

i use dreamweaver as my html editor & it doesn't add those forward slashes so seeing them in php examples is new to me.

 

Dreamweaver does not add them since your using the html 4.01 doctype. If you changed your settings to xhtml and xhtml 1.1, dreamweaver would add in the forward slashes and self close the tags.

Link to comment
Share on other sites

interesting... should i be coding vaild xhtml? is xhtml the future?

 

It's a personal choice. I use XHTML mainly because most everyone else does too, so it's a little more widespread. But HTML is fine as well. You just have to make sure that you live up to the coding standards of whichever one you decide to use.

 

As for XHTML - I'd say it's the current more than the future. Most current sites are using XHTML (or at least seem to be. I don't know if there are any stats on that). But when HTML 5.0 comes out, it may be that people will switch back to HTML from XHTML.

Link to comment
Share on other sites

why did people switch to xhtml? whats better about it?

 

xhtml is pretty much "strict html standards" html. - if that makes any sense.

 

In xhtml, you have to self close your tags, and must use all lowercase.

 

I personally believe, xhtml is far superior. It requires you to conform to a standard.

Link to comment
Share on other sites

Also, a common standard is nice when programming.  Adhering to more strict rules for 'proper' way to do things is never that bad of an idea.

 

Is there anything special about HTML 5 besides the <video> tag?  I haven't taken the time to read the w3c spec.. but will it not be following XHTML standards anyways?  lowercase tags, self closing etc..?

Link to comment
Share on other sites

HTML has a set of rules as well, and the code needs to conform to them. It's just that it is a little looser with what it will accept than XHTML is. But as long as the HTML code is written within the rules that define HTML, it will behave the way it is supposed to.

 

And search engines don't care which one you use.

 

That being said, I prefer XHTML, because I like the level of standardization the rules have, such as requiring all tags be closed and not allowing capital letters in the tags. It makes people's code so much easier to read, which makes it easier to find errors, and easier to understand what is going on.

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.