Jump to content

Archived

This topic is now archived and is closed to further replies.

gish

textfile radiobuttons

Recommended Posts

It is official I am going nuts
I am a beginner i php5. I got on the net and down loaded a lot of information. after reading the info. I decided to start
forms. 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 step

P.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 true
does anyone have an opinion.

Sorry P.S
Is 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>


Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
Share on other sites
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';

Share this post


Link to post
Share on other sites
[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?

Share this post


Link to post
Share on other sites
[!--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.

Share this post


Link to post
Share on other sites
[!--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 button
does 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

Share this post


Link to post
Share on other sites

×

Important Information

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.