Jump to content

Guys I need Help some need to Combine Checkbox and Textbox Value


sohailsaif

Recommended Posts

Hello everyone I am totally new in php i need some help in coding, Suppose I have 100 check boxes and one Textbox, I want to send the combined value of check box and textbox to another page. Like if i check a check box then the value of that check box and text box will be submitted to another page.

 Please see the attached b screenshot so you can get the idea

Thanks in Advance

 

 

 

post-173163-0-02902700-1412929426_thumb.jpg

Edited by Ch0cu3r
Removed URGENT from title
Link to comment
Share on other sites

It would be helpful if you could at least explain what it is you are trying to do.

 

You have so far posted a vague question and posted a picture which does not explain anything.

 

Having the word URGENT in your title does not get your question answered anytime sooner. All members here have given up their own free time to help out.

 

NB: I have cleaned this thread up

Link to comment
Share on other sites

It would be helpful if you could at least explain what it is you are trying to do.

 

You have so far posted a vague question and posted a picture which does not explain anything.

 

Having the word URGENT in your title does not get your question answered anytime sooner. All members here have given up their own free time to help out.

 

NB: I have cleaned this thread up

suppose there are 5 checkbox named .com, .net, .org, .co, .in and one textbox, when a user  enters "example" in the textbox and checks ".com" checkbox, i want to send the values of textbox which is "example: and the value of checkbox ".com" within a single string like "example.com" to another page when the user clicks on button.

Link to comment
Share on other sites

So - you really want an introduction to simple and basic php syntax.  May we suggest reading the first few chapters of the manual?  You'll learn a lot - especially how to concatenate strings.

i know how to concatenate strings and how to send it to another page, but the main problem are the checkboxes, because the selection of checkboxes depends on user as the user user can select any check box, So how to send the value of that checkbox which is selected?

Link to comment
Share on other sites

<input type="text" name="domain"><br>
<input type="checkbox" value=".com" name="tld[]">.com<br>
<input type="checkbox" value=".net" name="tld[]">.net<br>
<input type="checkbox" value=".org" name="tld[]">.org<br>
foreach($_POST['tld'] as $value){
echo $_POST['domain'].$value."<br>\n";
}

will give you what you are looking for, output to the screen I believe. Of course, you need the rest of the HTML and the php, only provided the relevant pieces here.

Edited by davidannis
Link to comment
Share on other sites

<input type="text" name="domain"><br>
<input type="checkbox" value=".com" name="tld[]">.com<br>
<input type="checkbox" value=".net" name="tld[]">.net<br>
<input type="checkbox" value=".org" name="tld[]">.org<br>
foreach($_POST['tld'] as $value){
echo $_POST['domain'].$value."<br>\n";
}

will give you what you are looking for, output to the screen I believe. Of course, you need the rest of the HTML and the php, only provided the relevant pieces here.

 

can you help me to asign the output data into a variable

 

i am using this code, but its not giving the actual output

 

foreach($tc=$_POST['tld'] as $value){

echo $tb=$_POST['domain'].$value."<br>\n";

}

$dn=$tc. ' ' .$tb;

echo "$dn";

 

 

Output: Array example.biz

 

i just want the actual string.

 

Please help me

Link to comment
Share on other sites

Output: Array example.biz

 

i just want the actual string.

 

"Array" is coming from this line:

foreach($tc=$_POST['tld'] as $value){
 
Since $_POST['tld'] is an array of checkbox values, $tc becomes "Array". To get the string, you just need to take the suggestion by davidannis and assign it to a variable. For example:
$selections = array();
foreach($_POST['tld'] as $value){
    $selections[] = $_POST['domain'].$value;
}
 
echo implode('<br>', $selections);
Link to comment
Share on other sites

 

"Array" is coming from this line:

foreach($tc=$_POST['tld'] as $value){
 
Since $_POST['tld'] is an array of checkbox values, $tc becomes "Array". To get the string, you just need to take the suggestion by davidannis and assign it to a variable. For example:
$selections = array();
foreach($_POST['tld'] as $value){
    $selections[] = $_POST['domain'].$value;
}
 
echo implode('<br>', $selections);

 

thank you so much for your help

Link to comment
Share on other sites

<?php
$dt=date("Y-m-d");
$tm=date("h:i:s");
$dtm= $dt." ". $tm;
$str="Merc200";
$pwd=md5("$str");
$src=("WEBCC-TUBANAEENG");
$ochecksum= md5("$src"+"$dtm"+"$pwd");
echo "$ochecksum";
$term=$_POST['term'];
$ns1=$_POST['ns1'];
$ns2=$_POST['ns2']
$reg_contact_type=$_POST['ctType1'];
$reg_company=$_POST['reg_company'];
$reg_fname=$_POST['reg_fname'];
$reg_lname=$_POST['reg_lname'];
$reg_addr1=$_POST['reg_addr1'];
$reg_addr2=$_POST['reg_addr2'];
$reg_state=$_POST['reg_state'];
$reg_city=$_POST['reg_city'];
$reg_postcode=$_POST['reg_postcode'];
$reg_telephone=$_POST['reg_telephone'];
$reg_fax=$_POST['reg_fax'];
$reg_country=$_POST['reg_country'];
$reg_email=$_POST['reg_email'];
$custom_reg1=$_POST['custom_reg1'];
$custom_reg2=$_POST['custom_reg2'];
$custom_reg3=$_POST['custom_reg3'];

$adm_contact_type=$_POST['ctType2'];
$admcompany=$_POST['adm_company'];
$admfname=$_POST['adm_fname'];
$admlname=$_POST['adm_lname'];
$admaddr1=$_POST['adm_addr1'];
$adm_addr2=$_POST['adm_addr2'];
$adm_state=$_POST['adm_state'];
$adm_city=$_POST['adm_city'];
$adm_postcode=$_POST['adm_postcode'];
$adm_telephone=$_POST['adm_telephone'];
$adm_fax=$_POST['adm_fax'];
$adm_country=$_POST['adm_country'];
$adm_email=$_POST['adm_email'];
$custom_adm1=$_POST['custom_adm1'];
$custom_adm2=$_POST['custom_adm2'];
$custom_adm3=$_POST['custom_adm3'];

$tec_contact_type=$_POST['ctType3'];
$tec_company=$_POST['tec_company'];
$tec_fname=$_POST['tec_fname'];
$tec_lname=$_POST['tec_lname'];
$tec_addr1=$_POST['tec_addr1'];
$tec_addr2=$_POST['tec_addr2'];
$tec_state=$_POST['tec_state'];
$tec_city=$_POST['tec_city'];
$tec_postcode=$_POST['tec_postcode'];
$tec_telephone=$_POST['tec_telephone'];
$tec_fax=$_POST['tec_fax'];
$tec_country=$_POST['tec_country'];
$tec_email=$_POST['tec_email'];
$custom_tec1=$_POST['custom_tec1'];
$custom_tec2=$_POST['custom_tec2'];
$custom_tec3=$_POST['custom_tec3'];

$bil_contact_type=$_POST['ctType4'];
$bil_company=$_POST['bil_company'];
$bil_fname=$_POST['bil_fname'];
$bil_lname=$_POST['bil_lname'];
$bil_addr1=$_POST['bil_addr1'];
$bil_addr2=$_POST['bil_addr2'];
$bil_state=$_POST['bil_state'];
$bil_city=$_POST['bil_city'];
$bil_postcode=$_POST['bil_postcode'];
$bil_telephone=$_POST['bil_telephone'];
$bil_fax=$_POST['bil_fax'];
$bil_country=$_POST['bil_country'];
$bil_email=$_POST['bil_email'];
$custom_bil1=$_POST['custom_bil1'];
$custom_bil2=$_POST['custom_bil2'];
$custom_bil3=$_POST['custom_bil3'];
$username=$_POST['username'];
$password=$_POST['password'];


$strContent="&source=$src";
$strContent="&otime=$dtm";
$strContent.="&url=http://www.oziq.net";
$strContent="&ochecksum=$ochecksum";
$strContent.="&domainname=sohailsaif.com";
$strContent="&ns1=$ns1";
$strContent="&ns2=$ns2";
$strContent="&reg_contact_type=ctType1";
$strContent="&reg_company=$reg_company";
$strContent="&reg_fname=$reg_fname";
$strContent="&reg_lname=$reg_lname";
$strContent="&reg_addr1=$reg_addr1";
$strContent="&reg_addr2=$reg_addr2";
$strContent="&reg_state=$reg_state";
$strContent="&reg_city=$reg_city";
$strContent="&reg_postcode=$reg_postcode";
$strContent="&reg_telephone=$reg_telephone";
$strContent="&reg_fax=$reg_fax";
$strContent="&reg_country=$reg_country";
$strContent="&reg_email=$reg_email";
$strContent="&custom_reg1=$custom_reg1";
$strContent="&custom_reg2=$custom_reg2";
$strContent="&custom_reg3=$custom_reg3";
$strContent="&adm_contact_type=$ctType2";
$strContent="&adm_company=$adm_company";
$strContent="&adm_fname=$adm_fname";
$strContent="&adm_lname=$adm_lname";
$strContent="&adm_addr1=$adm_addr1";
$strContent="&adm_addr2=$adm_addr2";
$strContent="&adm_state=$adm_state";
$strContent="&adm_city=$adm_city";
$strContent="&adm_postcode=$adm_postcode";
$strContent="&adm_telephone=$adm_telephone";
$strContent="&adm_fax=$adm_fax";
$strContent="&adm_country=$adm_country";
$strContent="&adm_email=$adm_email";
$strContent="&custom_adm1=$custom_adm1";
$strContent="&custom_adm2=$custom_adm2";
$strContent="&custom_adm3=$custom_adm3";
$strContent="&tec_contact_type=$ctType3";
$strContent="&tec_company=$tec_company";
$strContent="&tec_fname=$tec_fname";
$strContent="&tec_lname=$tec_lname";
$strContent="&tec_addr1=$tec_addr1";
$strContent="&tec_addr2=$tec_addr2";
$strContent="&tec_state=$tec_state";
$strContent="&tec_city=$tec_city";
$strContent="&tec_postcode=$tec_postcode";
$strContent="&tec_telephone=$tec_telephone";
$strContent="&tec_fax=$tec_fax";
$strContent="&tec_country=$tec_country";
$strContent="&tec_email=$tec_email";
$strContent="&custom_tec1=$custom_tec1";
$strContent="&custom_tec2=$custom_tec2";
$strContent="&custom_tec3=$custom_tec3";
$strContent="&bil_contact_type=$ctType4";
$strContent="&bil_company=$bil_company";
$strContent="&bil_fname=$bil_fname";
$strContent="&bil_lname=$bil_lname";
$strContent="&bil_addr1=$bil_addr1";
$strContent="&bil_addr2=$bil_addr2";
$strContent="&bil_state=$bil_state";
$strContent="&bil_city=$bil_city";
$strContent="&bil_postcode=$bil_postcode";
$strContent="&bil_telephone=$bil_telephone";
$strContent="&bil_fax=$bil_fax";
$strContent="&bil_country=$bil_country";
$strContent="&bil_email=$bil_email";
$strContent="&custom_bil1=$custom_bil1";
$strContent="&custom_bil2=$custom_bil2";
$strContent="&custom_bil3=$custom_bil3";
$strContent="&username=$username";
$strContent="&password=$password";


$postfield=$strContent;
$ch=curl_init();
$url2="https://ote.webnic.cc/jsp/pn_newreg.jsp";
curl_setopt($ch, CURLOPT_URL, $url2);
curl_setopt($ch,CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfield);
$strReturn=curl_exec($ch);
echo $strReturn;
curl_close($ch);

?>

 

I am getting an error

 

Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\Dashboard\register.php on line 13

 

can anyone please help me to solve the error?

Edited by sohailsaif
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.