Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Having A Strange Problem

Recommended Posts

Im having a strange problem and Im sure its some thing that ive over looked. A fresh set of eyes and suggestions would be great.

Simple form to pass data to a function.

On submit the function is accessed, but the data doesnt seem to get in to the check_status()

I know the check_status is working, when i type in the data ...

PHP Code:

$checkform = "<form method=\"post\" action=\"test.php\">  <table width=\"0%\"  border=\"0\" cellspacing=\"2\" cellpadding=\"2\">    <tr>      <td><strong>Messenger Service : </strong></td>      <td><select name=\"ms\">        <option selected>Select</option>        <option value=\"yim\">YIM</option>        <option value=\"msn\">MSN</option>        <option value=\"aim\">AIM</option>      </select></td>    </tr>    <tr>      <td><strong>User ID : </strong></td>      <td><input name=\"id\" type=\"text\"></td>    </tr>    <tr>      <td> </td>      <td><div align=\"right\">        <input type=\"hidden\" name=\"opi\" value=\"docheck\">        <input type=\"reset\" name=\"Reset\" value=\"Reset\">        <input type=\"submit\" name=\"Submit\" value=\"IM Check\">      </div></td>    </tr>  </table>  </form>";if ($opi != "docheck") {    echo "$checkform";    } elseif ($opi == "docheck") {    check_status('$ms', '$id', 0);}

If I do
PHP Code:
check_status('blah' , 'blah' 0);
Everything is fine ...... ideas?
Thanks,kvarnerexpress

Share this post


Link to post
Share on other sites

I don't really see a problem but what are you trying to do here?

if ($opi != "docheck") {   echo "$checkform";   } elseif ($opi == "docheck") {   check_status('$ms', '$id', 0);}

because the form is sending the data to "test.php" Though I might just be getting confuzed since I haven't done php in a while.

If that stuff is fine, then there is one thing that might make your coding easier... and maybe might have effect on if it works but I don't think it will. When I do php, I hate doing html in php so I don't. All you have to do is simply do ?> then do the html, which then you don't have to use the slashes. Then once you need php again, you do <?php

Just a little something that makes php easier, you might have already known about it but I thought I would mention it.

xJedix

Share this post


Link to post
Share on other sites

Try this:

There maybe another reason: register_global is turn off.

199730[/snapback]


That is possible. I suggest that you use the following:

 

if ($opi != "docheck") {   echo "$checkform";} elseif ($opi == "docheck") {   check_status($_POST["ms"],'$_POST["id"], 0);}

If register globals is not enabled, you can't just load the variables directly, you have so use the $_POST array.

 

Also, the single quotes may have been giving you a problem...

 

 

Good luck!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.