Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old November 13th, 2004, 03:57 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
how do you access form elements with PHP?

I'm trying to make a journal of sorts using php and I have been having trouble finding info on how to access form elements.

Here's what I want to do:

I have a site that will have one or more journals on it. The dates will be in a listbox and when someone selects a date, the journal entry associated with it shows up in an area beneath (or above) it. This area is a simple div tag with a php variable.

does this sound feasable? Is there something more that I need to do to get the entry to show up in the div tag? The errors show up in it already...

Reply With Quote
  #2  
Old November 13th, 2004, 04:33 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: how do you access form elements with PHP?

post the code you are currently using so we can get a better idea of exactly what you are doing. Form elements are referenced with the $_POST or $_GET superglobals depending on your form submission method.

Reply With Quote
  #3  
Old November 13th, 2004, 07:05 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: how do you access form elements with PHP?

here's the code that I've been working on if it will help. I've removed all of the unimportant(i think) stuff as well as the greater than/less than signs....

HTML
HEAD
TITLELfW site5/TITLE

link rel=stylesheet href="lfw.css" type="text/css"

?php

$xml_file = "journal.xml";

$xml_headline_key = "*JOURNAL*ENTRY*DATE";
$xml_description_key = "*JOURNAL*ENTRY*TEXT";

$story_array = array();

$counter = 0;
class xml_story{
var $headline, $description;
}

function startTag($parser, $data){
global $current_tag;
$current_tag .= "*$data";
}

function endTag($parser, $data){
global $current_tag;
$tag_key = strrpos($current_tag, '*');
$current_tag = substr($current_tag, 0, $tag_key);
}

function contents($parser, $data){
global $current_tag, $xml_headline_key, $xml_description_key, $counter, $story_array;
switch($current_tag){
case $xml_headline_key:
$story_array[$counter] = new xml_story();
$story_array[$counter]->headline = $data;
break;
case $xml_description_key:
$story_array[$counter]->description = $data;
$counter++;
break;
}
}

$xml_parser = xml_parser_create();

xml_set_element_handler($xml_parser, "startTag", "endTag");

xml_set_character_data_handler($xml_parser, "contents");

$fp = fopen($xml_file, "r") or die("Could not open file");

$data = fread($fp, filesize($xml_file)) or die("Could not read file");

if(!(xml_parse($xml_parser, $data, feof($fp)))){
die("Error on line " . xml_get_current_line_number($xml_parser));
}

xml_parser_free($xml_parser);

fclose($fp);

?


/HEAD
BODY

[snip]
TD ROWSPAN=2
div style="width:208px;height=245px;z-index:10;">
div
?php
echo "<select name="jrhdates">";
for($x=0;$x<count($story_array);$x++){
echo "<option value=".$x .">" . $story_array[$x]->headline . "</option>n";
}
echo "</select>";
?>
/div
div style="width:204px;height:220px;z-index=10;color:#B4A241;overflow:auto;clip:rect(0px ,200px,210px,0px);"
?php
echo $story_array[$_POST['jrhdates']]->description;
?
/div
/div

/BODY
/HTML

Reply With Quote
  #4  
Old November 13th, 2004, 11:50 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: how do you access form elements with PHP?

things I see are no form tags and no submit button, you can't submit a form if there are no form tags. If you left them out of the script you posted, please repost the script in full, half the script does not help.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > how do you access form elements with PHP?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway