Anxious Posted April 27, 2009 Share Posted April 27, 2009 I have done echo fields where the form is processed, and its not receiving an value.. In the form, I have this code <?php if($form->value("likes") == ""){ echo $database->getUserProfileInfo['likes']; }else{ echo $form->value("likes"); } ?> The above code works, however... <?php if($form->value("dislikes") == ""){ echo $database->getUserProfileInfo['dislikes']; }else{ echo $form->value("dislikes"); } ?> The above code doesn't. The form action is process.php, so I put an echo in and it doesn't recieve the values... Yet both codes are exactly the same setout, as I've been reading the code for 5-6 days now. Just don't understand why it don't recieve the values. It seems to be a big problem, I would deeply appreciate it if someone can assist me. Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/ Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 Any idea's guys? I've been trying to do it and I've not succeeded. I've even changed it to just echo $form->value("dislikes") which never worked.. Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-820993 Share on other sites More sharing options...
ILMV Posted April 28, 2009 Share Posted April 28, 2009 What form method are you using, get? post? Seeing your HTML code for the form would help. Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-820994 Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 Its POST. I don't understand why it all works, except the "Dislikes" and "Music" section <form action="process.php" method="POST"> <table width="708" border="0" align="center" cellpadding="3" cellspacing="0"> <tr> <td width="151">Profile Header:</td> <td width="377"><input name="slogan" type="text" value=" <?php if($form->value("slogan") == ""){ echo $database->getUserProfileInfo['slogan']; }else{ echo $form->value("slogan"); } ?>" size="60" maxlength="100"></td> </tr> <tr> <td><br> Full Name:</td> <Td><p> <br> <input name="fullname" type="text" value="<?php if($form->value("fullname") == ""){ echo $database->getUserProfileInfo['fullname']; }else{ echo $form->value("fullname"); } ?>" size="60" maxlength="100"> <tr> <td><br> Location:</td> <td><p> <br> <input name="profilelocation" type="text" value="<?php if($form->value("profilelocation") == ""){ echo $database->getUserProfileInfo['profilelocation']; }else{ echo $form->value("profilelocation"); } ?>" size="60" maxlength="100"> </td> </tr> <tr> <td><br> School/Job</td> <td><p> <br> <input name="schooljob" type="text" value="<?php if($form->value("schooljob") == ""){ echo $database->getUserProfileInfo['schooljob']; }else{ echo $form->value("schooljob"); } ?>" size="60" maxlength="100"> </td> </tr> <tr> <td><br> Martial Status</td> <td><p> <br> <select name="status" value="value""<?php if($form->value("status") == ""){ echo $database->getUserProfileInfo['status']; }else{ echo $form->value("status"); } ?>"> <option value="" selected></option> <option value="Not Saying"></option> <option value="Single">Single</option> <option value="Dating">Dating</option> <option value="In A Relationship">In A Relationship</option> <option value="Engaged">Engaged</option> <option value="Marriage">Marriage</option> <option value="Swinger">Swinger</option> <option value="It's Complicated">It's Complicated</option> </select> </td> </tr> <tr> <td><br> Likes:</td> <td><p> <br> <textarea name="likes" cols="60" rows="10" value"<?php if($form->value("likes") == ""){ echo $database->getUserProfileInfo['likes']; }else{ echo $form->value("likes"); } ?>"></textarea> </p></td> </tr> <tr> <td><br> Dislikes:</td> <td><p> <br> <textarea name"dislikes" cols="60" rows="10" value"<?php if($form->value("dislikes") == ""){ echo $database->getUserProfileInfo['dislikes']; }else{ echo $form->value("dislikes"); } ?>"></textarea></p> </tr> <tr> <td><br> Music:</td> <td><p> <br> <textarea name"music" cols="60" rows="10" value"<?php if($form->value("music") == ""){ echo $database->getUserProfileInfo['music']; }else{ echo $form->value("music"); } ?>"></textarea></p> </tr> <tr> <td> </td> <td><br> <td><br></td> <tr> <td colspan="2" align="right"><input type="hidden" name="subeditprofile" value="1"> <input name="submit" type="submit" value="Submit Changes"></td> </tr> <tr> <td colspan="2" align="left"></td> </tr> </table> </form> Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-820998 Share on other sites More sharing options...
PFMaBiSmAd Posted April 28, 2009 Share Posted April 28, 2009 textarea's don't have a value="...." parameter. It's likely that everything after the "likes" textarea is being treated as invalid form fields. Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821003 Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 Ahh.. so what would I do? Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821006 Share on other sites More sharing options...
PFMaBiSmAd Posted April 28, 2009 Share Posted April 28, 2009 Existing content goes between the <textarea>your content here</textarea> tags - http://w3schools.com/html/showit.asp?filename=tryhtml_textarea Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821007 Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 but the problem is... the "Likes" bit works, and it all gets entered into the database, but the dislikes and music don't... So why is it just one that works? Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821011 Share on other sites More sharing options...
PFMaBiSmAd Posted April 28, 2009 Share Posted April 28, 2009 Make the HTML valid and all of them will probably start working. Browsers try to do their best to recover from errors in the HTML they are given but can only recover from some types of bad HTML. Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821015 Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 should it be like this <textarea name"dislikes" cols="60" rows="10"><?php if($form->value("dislikes") == ""){ echo $database->getUserProfileInfo['dislikes']; }else{ echo $form->value("dislikes"); } ?> </textarea> and then it should work? Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821016 Share on other sites More sharing options...
PFMaBiSmAd Posted April 28, 2009 Share Posted April 28, 2009 All new-lines and spaces between the opening and closing tag become part of the data. Put the closing </textarea> tag immediately after the closing ?> php tag. ?></textarea> Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821018 Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 Okay, I sorted that out, should I test it out now Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821020 Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 Nope, it still doesn't work... dislikes and music are still not working. Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821022 Share on other sites More sharing options...
PFMaBiSmAd Posted April 28, 2009 Share Posted April 28, 2009 So, did you fix the HTML syntax in the "likes" tag? Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821023 Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 I changed it to this <tr> <td><br> Likes:</td> <td><p> <br> <textarea name="likes" cols="60" rows="10"><?php if($form->value("likes") == ""){ echo $database->getUserProfileInfo['dislikes']; }else{ echo $form->value("likes"); } ?></textarea> </p></td> </tr> <tr> <td><br> Dislikes:</td> <td><p> <br> <textarea name"dislikes" cols="60" rows="10"><?php if($form->value("dislikes") == ""){ echo $database->getUserProfileInfo['dislikes']; }else{ echo $form->value("dislikes"); } ?></textarea> </p> </tr> <tr> <td><br> Music:</td> <td><p> <br> <textarea name"music" cols="60" rows="10"><?php if($form->value("music") == ""){ echo $database->getUserProfileInfo['dislikes']; }else{ echo $form->value("music"); } ?></textarea> </p> </tr> Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821025 Share on other sites More sharing options...
PFMaBiSmAd Posted April 28, 2009 Share Posted April 28, 2009 Have you checked what exactly your form is submitting for debugging purposes? Add the following near the top of your form processing code - echo "<pre>"; echo "POST:"; print_r($_POST); echo "</pre>"; Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821026 Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 I did that, and when I submitted the form, all that comes up is this.. POST:Array ( [slogan] => Administrator of MyVee [fullname] => Jeanie Tallis [profilelocation] => East Yorkshire [schooljob] => Wolfreton Upper School [status] => Single [likes] => dgdfdg [subeditprofile] => 1 [submit] => Submit Changes ) Dislikes and Music aren't submitted. So a value isn't got. Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821029 Share on other sites More sharing options...
Potatis Posted April 28, 2009 Share Posted April 28, 2009 There is an = sign missing in your dislikes text field - name = "dislikes" <textarea name"dislikes" cols="60" rows="10"><?php if($form->value("dislikes") == "") should be: <textarea name="dislikes" cols="60" rows="10"><?php if($form->value("dislikes") == "") Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821030 Share on other sites More sharing options...
PFMaBiSmAd Posted April 28, 2009 Share Posted April 28, 2009 Good catch Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821033 Share on other sites More sharing options...
Potatis Posted April 28, 2009 Share Posted April 28, 2009 Same for the music section, where there were also problems. Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821035 Share on other sites More sharing options...
Anxious Posted April 28, 2009 Author Share Posted April 28, 2009 Wow... how stupid, how could I not see that. Thanks Link to comment https://forums.phpfreaks.com/topic/155816-solved-not-recieving-the-value-from-the-form/#findComment-821038 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.