Converting a form to ASP from PHP

I am a PHP guy, so I am in unfamilar territory, but have done a little work in VB. I am looking for as much help as possible, since I cannot really find a good tutorial. This form has to be accessible, namely Section 508. I would play with this myself, but I don’t have developer rights yet at work, and my personal domain doesn’t support

Upon reading, I am confused about the <asp:label> tag. Some pages it looks if the <asp:label> tag is eqivelent to the HTML <label> tag and on others it seems to be used as to print off a variable. The label tag is the main way to make a form accessible, so applying the correct version of the tag is important. Here is my PHP code:

  if(!isset($_POST['btnNext'])){ ?>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" name="sec">
<label for="guieline">What will your  SOW/RFP do?</label>
<select id="guideline" name="guideline">
<option value="doc">Creation of a document</option>
<option value="web">Creation of a website</option>
<option value="other">Other</option>
<input type="submit" value="Next" id="btnNext"name="btnNext">
<?php } else {
$guide = $_POST['guideline'];
  case "doc":
	echo '<p>You will be creating a document for this SoW or RFP.</p>
<textarea rows="10" cols="75" readonly="readonly" id="doctxt" 
onClick="SelectAll(\\'doctxt\\');" onFocus="SelectAll(\\'doctxt\\');">
  case "web":
	echo '<p>You will be creating a website for this SoW or RFP.
<textarea rows="20" cols="75" readonly="readonly" id="webtxt" 
onClick="SelectAll(\\'webtxt\\');" onFocus="SelectAll(\\'webtxt\\');">
  case "other":
	echo '<p>Your SoW/RFP may need to have multiple parts.
It will be best if you send the SoW/RFP to <a href="mailto:me">Ryan</a>. I will evaluate your SOW/RFP and let you know what is needed.</p>';break;
if($guide!== 'other'){
	echo '<p>Please submit your SOW/RFP for review and clearance to 
<a href="mailto:me?subject=SOW for Review">Ryan</a>.';

For non-PHP: This says

  1. Check if button if clicked
  2. If not, show form
  3. if clicked, get value from drop down
  4. run that through the switch statement and display whatever

This form submits to itself, which I read that ASP.NET does this by default.


Oh, ok. I did the code from post 3, and compared it to kitty’s code in post 7. Kitty took out the hidden inputs for simplicity? Should I use VS’s port or should I find a new one?

F5 should start the application in debugging mode. You sure there are no build errors?

I am 100%, opening a new page off the asp template, and typing <p>hey</p> is error free…

Hitting f5 is not doing anything. If I do ctrl+shift+w, it launches the development server launches using port 1287. I have VS Pro 2008.

If I paste the code block from post 3,

<form name="ctl00" method="post" action="HTMLPage.aspx" id="ctl00"> 
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE0ODMwOTY4ODZkZO05b7m4EB9NU3A68uvhmdCx2173" /> 
	<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLHmZ7PAgK5h62pD6Be0qntJ1HPB2SE7M9TgZSudqJG" /> 
  <label for="txtFirstName" id="lblFirstName"> 
First Name:</label> 
<br /> 
<input name="txtFirstName" type="text" id="txtFirstName" /> 

No idea why I get the validation parts?
I typed a random port in the box. In Chrome, http://my ip:188 goes to some page but asks to sign in. Going to IP or localhost in IE, it isn’t resolved.

I have xampp on the computer, but xampp/apache/MySQL are not running. i have SOPHOS anti-virus, so that would be 80 I suppose? I found the MS support how to change ports, and made it 90, as per post 16. Still no go, should I try like 1378?

I’ll jump in. You might have another program using port 80. If you are using an anti-virus or firewall it will take up port 80.

So I got IIS installed, it says it is running but if I go to http://[my IP] or http://[my IP]:80 it says cannot connect :frowning:

Nope, they’re not related. The asp:label element is there as a placeholder to allow you to dynamically display text to the page.

It doesn’t have anything to do with the label html element.

My AV uses ports: 80, 137, 138, 139, 445, 8192, 8193, 8194
According to their site

I installed IIS the other night, and checked that it was running.

Hitting f5 will start a server or should it do a preview like Dreamweaver does?

If you hit F5 in visual studio, it should fire up a testing server for you. Provided there are no build errors of course. Otherwise, you need to install IIS on you machine from the list of Windows Features

I have VS Pro v 8 I think.

How do you run the personal server?

Crap, I didn’t even think of that. If you do have VS, it already has a built in Web Server. And I think all versions use this feature. When you run your website through VS’s personal server, it will add the server port that will run in your favorite browser. However, when it comes to a ‘front-face’ server (live) you will still need to find out what is using port 80. $100 says it’s your anti-virus program.

It will start its own built in cassini web server and open a browser and look at the server it setup.

Just beware, that sometimes the cassini server behaves slightly differently to that of live servers. But nothing that should worry you. It is mainly the image/root mapping

I replied last time prior to see your code. That is some interesting naming conventions, especially the $ in the id. Can you show me a good tutorial site so I can do post #1?

That is correct.

It knows to put the for attribute the same value as the input due to AssociatedControlID, I am assuming?

Not exactly. It will rename the ID fields but other than that, yes.

I jammed it into a site I have here and it rendered as this:

<label for="ctl00_mainContent_txtFirstName" id="ctl00_mainContent_lblFirstName">
First Name:</label>
<br />
<input name="ctl00$mainContent$txtFirstName" type="text" id="ctl00_mainContent_txtFirstName" />

If you use AssociatedControlID it renders as a <label> if you don’t use AssociatedControlID then it renders as a <span>. Without using AssociatedControlID you are almost always better off using <asp:Literal> as it adds no useless markup.

I didn’t edit the code, but are you saying that will turn into:

<label for="txtFirstName">First Name:</label>
<br />
<input type="text" id="txtFirstName">

The <br /> is superfluous but it’s valid.