Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
| Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old July 11th, 2003, 07:18 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default php doesn't pick up an html variable

code in use: http://people.brandeis.edu/~m3rajk/J...rev/signup.php
code minus opening <?php: http://people.brandeis.edu/~m3rajk/J...rev/signup.txt

main issue (only one that MUST be resolved): php is not picking up the variable step in the submission of the 4th step.
function that creates the 4th step:
Code:
function s4(){
  ?>      <h1>THIS IS A TEST. IT DOES NOT HAVE A DATABASE CONNECTION NOR DOES IT CHECK USERNAMES. THIS LINE WILL BE REMOVED IN THE REAL ONE </h1>

      <p>Thank you for your interest in joining FindYourDesire.com. We need to know some things about you in order to make your profile here. Any feild in RED is required. Any feild marked with an * is confidential and will NOT show up in your user stats. Any feild with a #176; will not show up in your user stats, but is collected for future features. You will be notified before they are used.</p>
      <h2>NOTE: MAXIMUM PICTURE SIZE IS 150 KB</h2>
      <form enctype="multipart/form-data" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">
    <input type="hidden" name="step" value="5"><input type="hidden" name="MAX_FILE_SIZE" value="153600">
    <table frame="void" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" text="#c8c8c8">
        <tr><td>Your <a name="#confcode" href="#confcode" onClick="window.open('faq.php?seek=confcode', 'faq', 'width=500,height=250,scrollbars=yes');">Confirmation Code</a></td><td><input type="text" name="conf" size="25"></td></tr>
        <tr><td>Upload your main picture</td><td><input type="file"  accept="image/jpeg" name="main" size="25"></td></tr>
        <tr><td>Upload Thumb 1</td><td><input type="file"  accept="image/jpeg" name="t1" size="25"></td></tr>
        <tr><td>Upload Thumb 2</td><td><input type="file"  accept="image/jpeg" name="t2" size="25"></td></tr>
        <tr><td>Upload Thumb 3</td><td><input type="file"  accept="image/jpeg" name="t3" size="25"></td></tr>
        <tr><td>Upload Thumb 4</td><td><input type="file"  accept="image/jpeg" name="t4" size="25"></td></tr>
        <tr><td>Upload your <a name="#salute" href="#salute" onClick="window.open('faq.php?seek=salute', 'faq', 'width=500,height=250,scrollbars=yes');">salute</a></td><td><input type="file"  accept="image/jpeg" name="salute" size="25"></td></tr>
        <tr><td><input type="submit" value="Go To The Next Step"></td><td><input type="reset" value="Restart This Step"></td></tr>
    </table>
    </center>
  </body>
</html>
 <?php
}
internships are for the inexpereinced, yet corproations award them only to those with experience. then corporations complain about the lack of experience in the emerging workforce.

corporations need to get logical.
__________________
internships are for the inexperienced, yet corproations award them only to those with experience. then corporations complain about the lack of experience in the emerging workforce.

corporations need to get logical.
  #2 (permalink)  
Old July 14th, 2003, 12:09 AM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You've posted this problem in a bunch of threads -- the only advice I can give you is to look at the contents of $_POST for each form submission. At the top of your page, insert this debugging code:

echo "<pre>\$_POST is: ";
print_r($_POST);
echo "</pre>\n";

If there's a variable "missing", it's because your form didn't submit it.


Take care,

Nik
http://www.bigaction.org/
  #3 (permalink)  
Old July 14th, 2003, 10:58 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

actually i've noticed i've been getting no responses and sliding down the page so i just delete the thread and repost it updated.

technically i am looking at step each time. i have $_POST['step'] printed out in the first one, and i have its value passed when it's set, so i know it's not being set after the 4th, which means it's not being passed

internships are for the inexpereinced, yet corproations award them only to those with experience. then corporations complain about the lack of experience in the emerging workforce.

corporations need to get logical.
  #4 (permalink)  
Old July 14th, 2003, 11:41 AM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't really know why you're having a problem. Your page submits step = 4 on the step where you check all your hobbies and interests. It's available on the form where you enter your email confirmation code.

To verify that everything's there where/when you expect it, I repeat my suggestion: Right after your <body> tag, output the contents of $_POST.

<pre>$_POST is: <?php print_r($_POST);?></pre>


Take care,

Nik
http://www.bigaction.org/
  #5 (permalink)  
Old July 14th, 2003, 07:24 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the issue isn't function the function for step 3, but for step 4, when the step should be 5. since it's not setting step, it does not try the validation code. i have tried it with step after the upload size.

i am goign to insert your debugging code right after the body tag.

ok. your debugging line proves it's not being passed. i tried something....

http://people.brandeis.edu/~m3rajk/J.../varsignup.php

in this one i changed: <form enctype="multipart/form-data" action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">
to: <form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="POST">

it works there, but i don't know if the pictures would upload (i don't think i have access to the upload directory on that server, please don't try to test that) would it upload right without that line?

internships are for the inexpereinced, yet corproations award them only to those with experience. then corporations complain about the lack of experience in the emerging workforce.

corporations need to get logical.
  #6 (permalink)  
Old July 15th, 2003, 12:46 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No, by setting the enctype of the form, you're telling the form that you're sending encoded binary data in a file upload. I still don't get it -- if you have a form that submits data and files via post, your data will be in $_POST and your files will be in $_FILES.

Try this simple test script based on your form:
Code:
<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
  <input type="hidden" name="step" value="5">
  <input type="hidden" name="MAX_FILE_SIZE" value="153600">
  <table frame="void" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" text="#c8c8c8">
    <tr><td>Your Confirmation Code</td><td><input type="text" name="conf" size="25"></td></tr>
    <tr><td>Upload your main picture</td><td><input type="file"  accept="image/jpeg" name="main" size="25"></td></tr>
    <tr><td>Upload Thumb 1</td><td><input type="file"  accept="image/jpeg" name="t1" size="25"></td></tr>
    <tr><td>Upload Thumb 2</td><td><input type="file"  accept="image/jpeg" name="t2" size="25"></td></tr>
    <tr><td>Upload Thumb 3</td><td><input type="file"  accept="image/jpeg" name="t3" size="25"></td></tr>
    <tr><td>Upload Thumb 4</td><td><input type="file"  accept="image/jpeg" name="t4" size="25"></td></tr>
    <tr><td>Upload your <a name="#salute" href="#salute" onClick="window.open('faq.php?seek=salute', 'faq', 'width=500,height=250,scrollbars=yes');">salute</a></td><td><input type="file"  accept="image/jpeg" name="salute" size="25"></td></tr>
    <tr><td><input type="submit" value="Go To The Next Step"></td><td><input type="reset" value="Restart This Step"></td></tr>
  </table>
</form>
<?php
phpinfo();
?>
Submit the form using something unique for the confirmation code page; for example "MY_CONF_CODE". Select some files for the image inputs.

On the resulting page, search for your confirmation code. You should see it listed as a variable in $_POST and $_REQUEST. You should see your "step" variable in the same table. You should also see all your files just below that listed with your $_FILES.

By the way... what version of PHP are you using? Are you sure it's up to date??


Take care,

Nik
http://www.bigaction.org/
  #7 (permalink)  
Old July 15th, 2003, 01:38 PM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

my home server which, until i can get my dad to open it will remain internal, is running 4.2.2
the school's server is 4.1

shouldn't 4.1 be able to handle that?

internships are for the inexpereinced, yet corproations award them only to those with experience. then corporations complain about the lack of experience in the emerging workforce.

corporations need to get logical.
  #8 (permalink)  
Old July 15th, 2003, 01:51 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, it's easy for me to say that it *should* handle it. The only way you'll know is to install PHP 4.1 on your home machine and give it a try.

What did the output of phpinfo() tell you when submitting files AND form fields?


Take care,

Nik
http://www.bigaction.org/
  #9 (permalink)  
Old July 19th, 2003, 10:18 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i figured there's no need to do that since it loses posst entirely./ but i added it to step1 and step4. why not look for yourself. you'll see that it's a mess since i have the font set to #c8c8c8, but aside from needing to highlight, it says exactly what the post array says: nothing's there

internships are for the inexpereinced, yet corproations award them only to those with experience. then corporations complain about the lack of experience in the emerging workforce.

corporations need to get logical.
  #10 (permalink)  
Old July 21st, 2003, 02:57 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Okay -- look closely at your phpinfo() output. What's the value of "file_uploads"?

No value! PHP isn't configured to handle or allow file uploads. My guess is that PHP sees an incoming file, knows it's not configured to handle it, so throws away the incoming data.

The only thing to do is to ask the system administrator to enable file uploads in PHP. For security reasons, they should also upgrade PHP to the latest stable version.


Take care,

Nik
http://www.bigaction.org/




Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing HTML in a Variable Stevenm122084 XSLT 1 February 22nd, 2008 03:51 PM
Passing javascript variable to html or php ashraf_gawdat Javascript How-To 3 July 12th, 2006 02:48 PM
Variable in ASP HTML? thenextbillgates ASP.NET 1.0 and 1.1 Basics 0 April 7th, 2006 09:28 PM
html option value assigned to xsl:variable bergs77 XSLT 2 February 23rd, 2006 02:27 PM
dynamic XSLT from HTML variable rich0437 XSLT 0 May 19th, 2004 05:18 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.