gish Posted May 29, 2006 Share Posted May 29, 2006 It is official I am going nutsI am a beginner i php5. I got on the net and down loaded a lot of information. after reading the info. I decided to startforms. That easy enough. I can email it myself without a problem. The I decided that I would write to a text file on the apache2 server. I found some code of the net and that was easy enough. if you are writing text. put for three months I have been trying to get this php code to write its self to a text file on the server. I am sure at it is very easy.In the <head> I have been trying to get the variable $question to change value and then write and I cannot do it please can anyone help. Or even a tut that will break it down step by stepP.s. the next step for me I though was Mysql but i have been reading that mysql would be adquate for a beginner is this truedoes anyone have an opinion.Sorry P.SIs there a newsletter I can subscribe to for beginners in php<html><head><title>Sample</title></head><body><FORM method="POST" action="<?php echo $_SERVER['PHP_SELF']?>"><?php echo '<input type="radio" name="gender" value= $Question1 = "1" checked />1 unsure<br>'; echo '<input type="radio" name="gender" value= $Question1 = "2" />2 Thats true<br>'; echo '<input type="radio" name="gender" value= $Question1 = "3" />3 I never thought<br>'; echo '<input type="radio" name="gender" value= $Question1 = "4" />4 Nice one<br>';?><INPUT TYPE="SUBMIT" value="Send data"> </body></html> Link to comment https://forums.phpfreaks.com/topic/10684-textfile-radiobuttons/ Share on other sites More sharing options...
poirot Posted May 29, 2006 Share Posted May 29, 2006 I can't understand what is your problem. You don't need the $Question1 variable in there. Besides, the string is enclosed by single quotes, so it's not interpolated what means $Question1 would actually do nothing.Also, there is no such thing in HTML like value= something = "1". Simply value="1" is enough, assuming you just want to know the user's choice. Link to comment https://forums.phpfreaks.com/topic/10684-textfile-radiobuttons/#findComment-39875 Share on other sites More sharing options...
gish Posted May 29, 2006 Author Share Posted May 29, 2006 [!--quoteo(post=378004:date=May 29 2006, 02:16 AM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ May 29 2006, 02:16 AM) [snapback]378004[/snapback][/div][div class=\'quotemain\'][!--quotec--]I can't understand what is your problem. You don't need the $Question1 variable in there. Besides, the string is enclosed by single quotes, so it's not interpolated what means $Question1 would actually do nothing.Also, there is no such thing in HTML like value= something = "1". Simply value="1" is enough, assuming you just want to know the user's choice.[/quote]It sounds like i am trying to hard. if I am on the same wave lenght all i the number is suficent enough. so when it gets submited it reads the valued that is selected by the user. Then I have grab that info and send it. I am sorry poirot as I said I am only a beginner. Link to comment https://forums.phpfreaks.com/topic/10684-textfile-radiobuttons/#findComment-39904 Share on other sites More sharing options...
poirot Posted May 29, 2006 Share Posted May 29, 2006 No problem. When you have a group of radio buttons like this:[code]<input type="radio" name="fruit" value="banana"> Banana<input type="radio" name="fruit" value="apple"> Apple<input type="radio" name="fruit" value="lemon"> Lemon[/code]and the user selects for example "apple" when posted to PHP it gives you $_POST['fruit'] = 'apple'; Link to comment https://forums.phpfreaks.com/topic/10684-textfile-radiobuttons/#findComment-39998 Share on other sites More sharing options...
ale_jrb Posted May 29, 2006 Share Posted May 29, 2006 [code]<html><head><title>Favourite Fruit</title></head><body><p><strong>Question 1:</strong> What is your favourite fruit?<p><FORM method="POST" action="<?php echo $_SERVER['PHP_SELF']?>"><input type="radio" name="fruit" value="Apple" checked />Apple<br><input type="radio" name="fruit" value="Banana" />Banana<br><input type="radio" name="fruit" value="Grape" />Grape<br><input type="radio" name="fruit" value="Orange" />Orange<br><INPUT TYPE="SUBMIT" value="Send data"></body></html>[/code]Did you mean to do something like this? This asks that user their favourite fruit. They choose one of the options and click "Send" and it stores their answer in a text file. Is that what you were trying to do? Link to comment https://forums.phpfreaks.com/topic/10684-textfile-radiobuttons/#findComment-40053 Share on other sites More sharing options...
poirot Posted May 29, 2006 Share Posted May 29, 2006 [!--quoteo(post=378185:date=May 29 2006, 12:44 PM:name=ale_jrb)--][div class=\'quotetop\']QUOTE(ale_jrb @ May 29 2006, 12:44 PM) [snapback]378185[/snapback][/div][div class=\'quotemain\'][!--quotec--]Did you mean to do something like this? This asks that user their favourite fruit. They choose one of the options and click "Send" and it stores their answer in a text file. Is that what you were trying to do?[/quote]Actually I was giving him an example [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /] Obviously you'd need the form, the submit button and so on, but I was justing showing him the basics of radio buttons. Link to comment https://forums.phpfreaks.com/topic/10684-textfile-radiobuttons/#findComment-40062 Share on other sites More sharing options...
gish Posted June 2, 2006 Author Share Posted June 2, 2006 [!--quoteo(post=378185:date=May 29 2006, 02:44 PM:name=ale_jrb)--][div class=\'quotetop\']QUOTE(ale_jrb @ May 29 2006, 02:44 PM) [snapback]378185[/snapback][/div][div class=\'quotemain\'][!--quotec--][code]<html><head><title>Favourite Fruit</title></head><body><p><strong>Question 1:</strong> What is your favourite fruit?<p><FORM method="POST" action="<?php echo $_SERVER['PHP_SELF']?>"><input type="radio" name="fruit" value="Apple" checked />Apple<br><input type="radio" name="fruit" value="Banana" />Banana<br><input type="radio" name="fruit" value="Grape" />Grape<br><input type="radio" name="fruit" value="Orange" />Orange<br><INPUT TYPE="SUBMIT" value="Send data"></body></html>[/code]Did you mean to do something like this? This asks that user their favourite fruit. They choose one of the options and click "Send" and it stores their answer in a text file. Is that what you were trying to do?[/quote]this is exactly what i was looking for. but this raises an issiue when you use a submit buttondoes the submit button gather all the in information with in the form and then send it the server. witth this code<FORM method="POST" action="<?php echo $_SERVER['PHP_SELF']?>">if so when it sends how do I manipulte it. not sure how this works"<?php echo $_SERVER['PHP_SELF']?>Iam sure that it is very easy when you know now Link to comment https://forums.phpfreaks.com/topic/10684-textfile-radiobuttons/#findComment-41090 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.