1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Help convert this simple PHP to ASP

Discussion in 'C#' started by Topfrog007, Oct 2, 2008.

  1. #1
    Hi everyone, I have a very simple PHP foreach loop that I need help with converting to asp.

    Can anyone help?

    It looks bigger than it is because of comments =)
    SEMrush
    I tried php to asp converters but they didn't completely work and I couldn't figure the rest out.

    
    <?php
    	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    	*														 *
    	*  	This page loops through each posted value ($_POST) 	 *
    	*	and creates a string formatted like:				 *
    	*	fieldname1: fieldvalue1								 *
    	*	fieldname2: fieldvalue2								 *
    	*	etc.												 *
    	*	It has the advantage of not needing to know the 	 *
    	*	names of the field names that get posted			 *
    	*														 *
    	* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    	
    if(isset($_POST['first-name'])) { //user submitted the form	
    	
    	$message = ''; //create a string variable message
    	foreach($_POST AS $key => $value) {
    		
    		/* this foreach loop does this:
    		 * for each posted name be able to reference it as $key
    		 * for each posted value be able to reference as $value
    		 * this way I don't need to know the names of the posts to get their values
    		 * the TM__ is a string I started some form names with so I could add extra spaces for formatting
    		 * I then remove the TM__ from each name be using the ereg_replace function
    		 * then I send an email using mail();
    		*/
    		
    	
    		if(eregi('TM__', $key)) {
    			$message .= "\n\n".ereg_replace('TM__', '', $key)."\n";
    		} else {
    			$message .= $key.' : '.$value."\n";
    		}
    	}
    	mail("myemail@here.com", 'Email Subject', $message);
    	$success = 1;
    }
    
    ?>
    
    
    
    Code (markup):
     
    Topfrog007, Oct 2, 2008 IP
    SEMrush