0

Hi,

I am wondering if i am able to insert 2 entries from a form to mysql.
for example:

</tr>
		<tr>
			<td bgcolor="#eeeeff">
			Is it a shared devices?<br>
			<font color='#F62817'>** If yes, please indicate the shared device num. </font>
			</td>
			<td bgcolor="#eeeeff">
				<SELECT name="shared">
				<option value="No"SELECTED>No</option>
				<option value="Yes">Yes</option>
			<INPUT type = "TEXT" name = name = "shared_remark" value = "NIL">
			
		</tr>

this the code, there are 2 questions asked and i want to the user to key in shared num if they choose "yes" option.
this 2 entries name (shared and shared_remark) will be inserted into the same field name of mysql. Can this be done?

I am trying to do this but doesnt seem to work.

echo $shared  + $shared_remark ;

thanks

Edited by futhonguy: n/a

2
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by futhonguy
0

I am trying to do this but doesnt seem to work.

echo $shared  + $shared_remark ;

1) PHP uses the '.' for a concatenation operator, like this:

echo $shared . $shared_remark;

2)
I'm assuming you're trying to do that after the user submits the info? In which case, are you getting the data from the $_POST array first?

Example:

$shared = $_POST['shared'];
if($shared == "Yes") {
$shared_remark = $_POST['shared_remark'];
}

Edited by Lsmjudoka: n/a

0

1) PHP uses the '.' for a concatenation operator, like this:

echo $shared . $shared_remark;

2)
I'm assuming you're trying to do that after the user submits the info? In which case, are you getting the data from the $_POST array first?

Example:

$shared = $_POST['shared'];
if($shared == "Yes") {
$shared_remark = $_POST['shared_remark'];
}

Yes that's what i am what i want - Thanks

Also, will php be able to do for example -
if user is to choose 'No', the text box will not appear and if 'Yes' is chosen, the text box will appear for the user to key in the remark.

0

Also, will php be able to do for example -
if user is to choose 'No', the text box will not appear and if 'Yes' is chosen, the text box will appear for the user to key in the remark.

No, PHP is strictly server-side. However, you can use PHP to echo the neccessary JavaScript or CSS. I'm not a JS/CSS expert, so you'll have to ask someone else how to do that.

0

No, PHP is strictly server-side. However, you can use PHP to echo the neccessary JavaScript or CSS. I'm not a JS/CSS expert, so you'll have to ask someone else how to do that.

No worries. Thanks for your help. =)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.