By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,639 Members | 3,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,639 IT Pros & Developers. It's quick & easy.

Values not passing - this has truely stumped me!

P: 2
Hi all, I've encountered a problem which I can't for the life of me figure out what's going on.

Here's the problem:

I have a dating site which lets members edit their profiles (i.e. location, details and photos). What should happen when a user makes a change and clicks on the save button is: 1) All values from within the form passed onto the processing page, 2) the appropriate checks done then the database updated with new info.

The problem is that for some reason all BUT the photo values are being passed through. For example, below is a snapshot of the HTML form used:

[HTML]

<form method="POST" action="editprofile.php?do=add" enctype="multipart/form-data">

<TD><input type='text' name='location' maxlength='100' size='25' tabindex='2'></TD><TR>

-------- has a few more INPUT fields up to :

<TD><img src=<?php echo"$tphoto1";?> border='0'></a> </TD>
<TD><input type='file' name="p1" tabindex='20'></TD>

<TD width='50%' align='left'>
<input type='submit' name='subreg' value='Save Changes' tabindex='26'>
</TD>
</FORM>

[/HTML]

(I've cut out chunks of the form for ease of reading).

Now, when the values are passed to the editprofile.php page, I do the following test:

[PHP]

if(!empty($_GET)) extract($_GET);
if(!empty($_POST)) extract($_POST);


switch(@$do)
{

case "add" :

echo"location is $location";
echo "$p1";
exit();

[/PHP]

This happily echos the content of the location variable, but always brings up the p1 variable as empty!

The funny thing is Ive used this exact same script when the user creates their profile without any problems.

I have tried to change the name of the input field in case p1 was being used anywhere else, I have also used $_POST to see if that would work.

I have spent a number of hours trying to get to the bottom of this and am stuck as I have ever been (as frustrated!).

Any help on this would be greatly appreciated.
Jan 29 '07 #1
Share this Question
Share on Google+
2 Replies


Motoma
Expert 2.5K+
P: 3,235
Hi all, I've encountered a problem which I can't for the life of me figure out what's going on.

Here's the problem:

I have a dating site which lets members edit their profiles (i.e. location, details and photos). What should happen when a user makes a change and clicks on the save button is: 1) All values from within the form passed onto the processing page, 2) the appropriate checks done then the database updated with new info.

The problem is that for some reason all BUT the photo values are being passed through. For example, below is a snapshot of the HTML form used:

[HTML]

<form method="POST" action="editprofile.php?do=add" enctype="multipart/form-data">

<TD><input type='text' name='location' maxlength='100' size='25' tabindex='2'></TD><TR>

-------- has a few more INPUT fields up to :

<TD><img src=<?php echo"$tphoto1";?> border='0'></a> </TD>
<TD><input type='file' name="p1" tabindex='20'></TD>

<TD width='50%' align='left'>
<input type='submit' name='subreg' value='Save Changes' tabindex='26'>
</TD>
</FORM>

[/HTML]

(I've cut out chunks of the form for ease of reading).

Now, when the values are passed to the editprofile.php page, I do the following test:

[PHP]

if(!empty($_GET)) extract($_GET);
if(!empty($_POST)) extract($_POST);


switch(@$do)
{

case "add" :

echo"location is $location";
echo "$p1";
exit();

[/PHP]

This happily echos the content of the location variable, but always brings up the p1 variable as empty!

The funny thing is Ive used this exact same script when the user creates their profile without any problems.

I have tried to change the name of the input field in case p1 was being used anywhere else, I have also used $_POST to see if that would work.

I have spent a number of hours trying to get to the bottom of this and am stuck as I have ever been (as frustrated!).

Any help on this would be greatly appreciated.

If I am reading your code correctly, p1 is an input of type file. This means you will need to access it via the $_FILES variable.
Jan 29 '07 #2

P: 2
I cant believe I missed the obvious mistake... it's always the simple things that seem to trip me up!!!


Thanks... all working now... much appreciated!
Jan 29 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.