A variable in a php statement

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default A variable in a php statement

    Hi This works: <?php if (isset($_GET['frm_sortby'])) {
    echo '<input type='hidden' name='frm_catid' value='71'>'; } else { echo
    '<input type='hidden' name='frm_catid' value='70'>'; } ?> but this doesnt
    and I dont know why <?php if
    (isset($_GET['frm_sortby'])) { echo '<input type='hidden' name='frm_catid'
    value='$HTTP_GET_VARS['frm_catid']'>'; } else { echo '<input type='hidden'
    name='frm_catid' value='70'>'; } ?> I'd love some help please.. Simon

    sjmyles Guest

  2. Similar Questions and Discussions

    1. #39251 [NEW]: variable variable class array property is read only
      From: taskfreak at gmail dot com Operating system: mac os PHP version: 5.1.6 PHP Bug Type: Class/Object related Bug...
    2. Setting a SQL Statement as a Variable and Running UsingCFQuery
      I've got a table with a bunch of sql statements that I need to run and cfdump the results to the screen. I have one <cfquery> tag that pulls the...
    3. variable select statement
      I would like to have a form that gives the user choices for selection parameters for email, printing etc. A real simple example: Give me all...
    4. Session variable in SELECT statement?
      What am I doing wrong here? This works: SELECT Count(ID) AS MyCount FROM mytable WHERE Status = '1' But when I try to add a session value in...
    5. SqL statement needs to have a variable represent a value
      Have you done the old response.write sqlstr? I'll bet you get a result like...... SELECT gameweek, season, dbcode, teamname FROM tblNFLGameData...
  3. #2

    Default Re: A variable in a php statement

    Try th following <?php if (isset($_GET['frm_sortby'])) { echo '<input
    type='hidden' name='frm_catid' value='$_GET['frm_catid']'>'; } else { echo
    '<input type='hidden' name='frm_catid' value='70'>'; } ?> Ross

    Ross Riley Guest

  4. #3

    Default Re: A variable in a php statement

    Thanks I tried that but no good - same error message. Parse error: syntax
    error, unexpected T_STRING, expecting ',' or ';' in
    c:\Inetpub\wwwroot\NewSite\TMPozvqccxam.php on line 196 I have the variable
    frm_catid set as a url variable so im a bit stumped

    sjmyles Guest

  5. #4

    Default Re: A variable in a php statement

    .oO(sjmyles)
    >Thanks I tried that but no good - same error message. Parse error: syntax
    >error, unexpected T_STRING, expecting ',' or ';' in
    >c:\Inetpub\wwwroot\NewSite\TMPozvqccxam.php on line 196
    Hint: You can't put unescaped single quotes into a single quoted string.

    Micha
    Michael Fesser Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139