WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-04-2005, 12:12 PM
WebProWorld Member
 

Join Date: Sep 2003
Posts: 81
ambassador RepRank 0
Default Make A Single HTML Page React To Form Input

-------
Jun 4, 2005

GOAL:

Use one single HTML page (or SHTML page) to instantly display a different message based upon the website viewer's input to a simple form.

A pop-up or second HTML page is not desired in this matter. The message must appear on the same page as the form, not on a similarly formatted page.


PSEUDO EXAMPLE:

<center>
<select name="color">
<option>Select A Color</option>
<option>Red</option>
<option>Blue</option>
<option>Green</option>
</select>

<span style="color: #FFCC66;">


You selected red.


You selected blue.


You selected green.


Please select a color.

</span>
</center>


COMMENTS:

It is important that the unique message appear in the designated area of the same web page immediately after the website viewer clicks their choice of color. The server environment is a Linux-based hosting service. Your suggestions are requested. Thank you in advance.

Ambassador
-------
Reply With Quote
  #2 (permalink)  
Old 06-06-2005, 03:55 PM
WebProWorld Member
 

Join Date: Sep 2003
Posts: 81
ambassador RepRank 0
Default

-------
Jun 6, 2005

Is this task impossible?

Is there even a way of including some PHP code within the HTML page that will accomplish the task?


Ambassador
-------
Reply With Quote
  #3 (permalink)  
Old 06-06-2005, 04:31 PM
WebProWorld 1,000+ Club
WebProWorld Moderator
 

Join Date: May 2004
Location: Austin, TX
Posts: 1,330
jestep RepRank 0
Default

I think you're going to have to do it with javascript. Look up javascript and Dhtml.
Reply With Quote
  #4 (permalink)  
Old 06-07-2005, 06:59 PM
WebProWorld Member
 

Join Date: Sep 2003
Posts: 81
ambassador RepRank 0
Default

-------
Jun 7, 2005

The lack of solutions posted here suggests that you may be correct jestep.


On a similar note about SSI capabilities, can SSIs be used to display a different string of text based upon the date?


PSEUDO CODE


Today is sometime before 2005/07/31.

Today is 2005/07/31 or later.




MODERATORS: While I continue to receive email notifications from all other forums in which I participate, I do not receive notifications from WebProWorld threads in which I participate. The "Notify me when a reply is posted" option is checked on this thread but the notifications are not received - not even in the "deleted" or "spam" folders. How can this matter be resolved?


Ambassador
-------
Reply With Quote
  #5 (permalink)  
Old 06-08-2005, 06:47 AM
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Cornwall, UK
Posts: 833
speed RepRank 1
Default

As you can use PHP it would be better to have a form which posts to its self, then have the PHP redisplay the page inserting the information.

If you use JS only then anyone with JS disabled won't be able to use the page.

A very quick and dirty snippet of PHP/HTML is:
Code:
<?php
    $c = 0;
    if(isset($_POST['update'])) {
        switch($_POST['color']) {
        case 1: echo 'Red'; break;
        case 2: echo 'Blue'; break;
        case 3: echo 'Green'; break;
        }
        $c = $_POST['color'];
    }
?>
<form action="#" method="post">
    <select name="color">
        <option value="1" <?php if($c == 1) echo 'selected="selected"'; ?>>Red</option>
        <option value="2" <?php if($c == 2) echo 'selected="selected"'; ?>>Blue</option>
        <option value="3" <?php if($c == 3) echo 'selected="selected"'; ?>>Green</option>
    </select>
    <input type="submit" name="update">
</form>
If you then add a JS onchange handler to <select> then as the user changes the selection the form will auto submit, if the user doesn't have JS then they will have to click the submit button.
Quote:
On a similar note about SSI capabilities, can SSIs be used to display a different string of text based upon the date?
I would use PHP.
Quote:
MODERATORS: While I continue to receive email notifications from all other forums in which I participate, I do not receive notifications from WebProWorld threads in which I participate. The "Notify me when a reply is posted" option is checked on this thread but the notifications are not received - not even in the "deleted" or "spam" folders. How can this matter be resolved?
If like me you are using a block list you'll have to explicitly allow emails from this board through as they seem to have got their servers listed as a spam source.
__________________
TOLRA Micro Systems Limited US & UK Web Hosting with Continuous Data Protection
Web Directory 2 for 1 Offer : Web Directory Script
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , , , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0