Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Syntax problem

Posted on 2008-06-09
16
Medium Priority
?
247 Views
Last Modified: 2010-04-21
I am having a syntax problem and I can't figure out what the problem is.

review.php contains this line:
<input disabled="true" name="Vote" type="text" size="1" maxlength="1" style = "color:#2E3237;background: #D9E7F5;border: 1px solid #2E3237;font-family: Arial, Verdana, Helvetica, sans-serif;">
(a number value from a javascript populates the box)

submit.php contains this line:
$stars = $_POST['Vote'];
<h3>Stars: <? echo $stars ; ?></h3>

I am not getting anything in $stars -  am I missing something here?
0
Comment
Question by:lvollmer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 3
  • +1
16 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 21747072
Is the form submitted by POST or GET Does $_REQUEST instead of $_POST work?
0
 

Author Comment

by:lvollmer
ID: 21747093
I tried all three methods and none of them are working.
0
 
LVL 48

Expert Comment

by:hernst42
ID: 21747117
Are you sure the input element is inside the desired form tag?
what do yo get if you do
var_dump($_REQUEST);
 in submit.php?
0
WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

 
LVL 35

Expert Comment

by:Terry Woods
ID: 21747130
You'll probably need to post more of your code from review.php... can you post the <form> tags and surrounding code?
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 21747138
and the javascript that populates the value
0
 

Author Comment

by:lvollmer
ID: 21747141
I attached review.php code
HEADER CODE:
<script language="JavaScript" type="text/javascript">
<!--
function updateVote(the_vote_chosen) {
	document.review.Vote.value = the_vote_chosen;
}
//-->
</script>
 
BODY CODE:
<body>
  <p>
    <? $vid = $_GET['vid']; ?>
</p>
  <table width="550" border="0" cellspacing="2" cellpadding="2">
    <tr>
      <td><div id = "headermast" style = "padding-top:10px;padding-bottom:10px;padding-left:5px;"><img src = "http://www.lohud.com/graphics/mastlogo.gif"/></div></td>
    </tr>
    <tr>
      <td bgcolor="#F4F4E4"><form id="form1" name="review" method="post" action="submit.php">
      <h3>
        Review this restaurant </h3>
      <p>
        <input name="vid" type="hidden" value="<? echo $vid; ?>" />
      </p>
      <p><strong>Vote 1-5 stars</strong></p>
      <table width="150" border="0" cellspacing="2" cellpadding="2">
        <tr>
          <td><div align="center"><a href="#" onmouseover="updateVote(1)"  onclick="updateVote(1);return false;"><img src="rating_on.gif" width="12" height="12" border = "0"/></a></div></td>
          <td><div align="center"><a href="#" onmouseover="updateVote(2)"  onclick="updateVote(2);return false;"><img src="rating_on.gif" width="12" height="12" border = "0"/></a></div></td>
          <td><div align="center"><a href="#" onmouseover="updateVote(3)"  onclick="updateVote(3);return false;"><img src="rating_on.gif" width="12" height="12" border = "0"/></a></div></td>
          <td><div align="center"><a href="#" onmouseover="updateVote(4)"  onclick="updateVote(4);return false;"><img src="rating_on.gif" width="12" height="12" border = "0"/></a></div></td>
          <td><div align="center"><a href="#" onmouseover="updateVote(5)"  onclick="updateVote(5);return false;"><img src="rating_on.gif" width="12" height="12"border = "0" /></a></div></td>
		 <td> <input disabled="true" name="Vote" type="text" size="1" maxlength="1" style = "color:#2E3237;background: #D9E7F5;border: 1px solid #2E3237;font-family: Arial, Verdana, Helvetica, sans-serif;"></td>
        </tr>
      </table>
      <p><strong>Review this restaurant</strong></p>
      <p>
    <textarea name="review" cols="50" rows="10"></textarea>
</p>
  <p>
    <input type="submit" name="Submit" value="Submit" />
  </p>
</form></td>
    </tr>
  </table>

Open in new window

0
 

Author Comment

by:lvollmer
ID: 21747149
var_dump provides me with this:

array(5) { ["vid"]=>  string(4) "5420" ["review"]=>  string(4) "description here" ["Submit"]=>  string(6) "Submit" ["s_cc"]=>  string(4) "true" ["s_sq"]=>  string(5) "[[B]]" }
0
 
LVL 48

Expert Comment

by:hernst42
ID: 21747164
Might happen because name and id of the form differ. this can lead to very special results depending on the used browser. the form name and id should be the same for the form-tag.
0
 

Author Comment

by:lvollmer
ID: 21747222
still no luck when I change the id tag to match the form name.
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 21747387
Do you see the vote value change in the disabled field before submitting it?
0
 

Author Comment

by:lvollmer
ID: 21747441
yes - here is the link to the actual page:

http://tjnne    ws.com/etweb/venuereview/review.php

remove the spaces in the URL
0
 
LVL 35

Expert Comment

by:Terry Woods
ID: 21747513
I wonder if the "disabled" property of the field is stopping it from being submitted? Perhaps you could try removing that to see if it fixes the problem. If so, maybe we can find an alternative way of disabling the field
0
 
LVL 18

Expert Comment

by:Hube02
ID: 21747711
The answer to TerryAtOpus' question is, Yes. Disabled fields do not get submitted. If you want a filed the user can see, but not edit, and gets submitted, use the readonly property.
0
 

Author Comment

by:lvollmer
ID: 21748159
can someone give me an example of that
0
 
LVL 35

Accepted Solution

by:
Terry Woods earned 2000 total points
ID: 21748283
Apparently this should do it:
<input readonly name="Vote" type="text" size="1" maxlength="1" style = "color:#2E3237;background: #D9E7F5;border: 1px solid #2E3237;font-family: Arial, Verdana, Helvetica, sans-serif;">

Open in new window

0
 

Author Closing Comment

by:lvollmer
ID: 31465572
It worked, THANKS!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question